function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
RamsRams 

How to run Javascript code while record creation

Hi,

 


I need to update some information automatically through java script after a record is created. Please help me..

 

 

I have created vf page and if i run that vf page value will come in to vf page. I need to update that value after a record is created. Please help me how to solve this..

 

Thanks,

Rams

BharathimohanBharathimohan

Hi Ram,

 

 

you can use the oncomplete event after calling your save action.

 

 

example,

 

action="{!saveMyRecord}" oncomplete="updatetheRecord();"

 

 

updatetheRecord(); can be your Javacript.

 

 

Regards,

Bharathi
Salesforce For All

Hit Kudos & Mark this post as solved, if it helps you

 

Bhawani SharmaBhawani Sharma
What operation you want to perform in javascript? Just asking to get the better idea of your requirement, so i can tell you better solution if I have.
mk2013mk2013

I also have similar requirement. I am a newbie to SalesForce and I need to make a AJAX call to external webapp from inside the onclick event of a custom button. 

I tried to use it as below.

sforce.connection.remoteFunction({
url : 'my url',
async : true,
cache : false,
method: "GET",
onSuccess : function(response) { alert('OK: '+response); },
onFailure : function(response) { alert('ERROR: '+response); }
});

and I get Error 400 Endpoint protocol(http/https) mismatch:


my url is correct and it works fine in the browser I also tried using plain AJAX nothing has worked. 

My service is a REST service and returns JSON.

 

Please help,  I am struggling for last 2 days for this. I tried the call in a VF page and it works fine, but the problem is this code is supposed to run in onclick javascript evenet of a custom button. I tried to change this button to content souce to 'Visual Force' but then I do not see any VF pages in teh dropdown list to select from. 

 

Thanks in advance,

mk2013

RamsRams

Hi,

 

I need to update the geo address in to one custom field at the time of record creation. Means after creating a record need to automatically update the address in to custom field.

 

Thanks,

Rams

Bhawani SharmaBhawani Sharma

Can't you use trigger for that?

RamsRams

Hi,

 

I have tried but not getting. i am unable to use that one.. If you have any idea.. please let me know... Value is coming in vf page... i need to get that value in to trigger..  How can i get that value.. Please help me...

 

Thanks,

 

Rams

Bhawani SharmaBhawani Sharma
Do you have any controller associated with this page?
RamsRams

Hi,

 

Yeah, I have controller with that vf page.  I am getting value in to controller. If i use that vf page as inline vf page its working fine. But i need to open that record for getting value in to record. I need to pul the data automatically. If you want code i will provide my code. Do you have any idea please let me know.

 

Thanks,

Rams

 

 

Bhawani SharmaBhawani Sharma
I am still trying to understand your exact issue, but here is my initial thoughts:
You can create a homepage component and place it on sidebar. put condition to execute this under specific conditions.