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
JGrafJGraf 

First Attempt at Developing

I want to create a button on a master object that hits a specific button on every child object of that record.  I have about a year's worth of Salesforce under my belt.  What would be the best resource to learn how to do this?  Am I jumping in over my head? 

Best Answer chosen by Admin (Salesforce Developers) 
HariDineshHariDinesh

Hi,

Create Button on Master object and then call a method in a call from that button, pass the required parameters to that method.

Query all the child’s for that objects. Now you have that entire id’s of child’s. Perform the required operation on child records.

 

Example to call Apex Class from a Button (JS):

 

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

var url = parent.location.href; 
var strapID=''; 
strapID = "'"+'{!Approval_Object__c.Id}'+"'"; 
var lengt = strapID.length; 
var appid = strapID.substring(1,lengt-1); 


var response = sforce.apex.execute( "recallapprovalprocess","mtdhrecallapprovalprocess", {idslist:appid,sObjectType:'Approval_Object__c'}); 
if (response != '') 
{ 
alert('You are not allowed to Cancel') ; 
} 
else 
{ 
parent.location.href = url; 
}

 

Here about sforce.apex.execute Web Service Request in WEB and you can implement your required logic.