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
devendra dhakadevendra dhaka 

Custom Detail page button coding

I have to write down a Detail page button which will be fetching information from the current record and will be updating another custom object .

 

'm able to find information on List Page Buttons , but nothing for this  :(

 

Any help will be appreciated :)

devendra dhakadevendra dhaka

I have created a code to achieve some functionality. I have to fetch a record based on some requirement from another custom object.

 

How to write a SOQL query in this code ??

 

 

 

{!REQUIRESCRIPT("/soap/ajax/13.0/connection.js")}

var newRecords = [];

var c = new sforce.SObject("Leave_Application__c");
c.id ="{!Leave_Application__c.Id}";

c.Application_Status__c = "Rejected";
newRecords.push(c);

result = sforce.connection.update(newRecords);

if (result[0].success=='false') {
alert(result[0].errors.message);
} else {
location.reload(true);}

 

 

 

sanjaypatidarsanjaypatidar

Here is a sample query which can be used from the detail page -

 

result = sforce.connection.query("Select Id, Name from Account");
devendra dhakadevendra dhaka

Hi Sanjay,

 

I tried that

 

but in my case when fetching ID from the custom object instead of a proper id field its giving me EXT-GEN1

 

 

Why is that happening ??

sanjaypatidarsanjaypatidar

I am not sure if i am getting your issue here, can you elaborate and put code snippet in for troubleshooting.