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
sfdc_syedsfdc_syed 

Read the following Scenario

Hi,

 

I have scenario like there are two custom objects  i.e.salary and BankAccount.

In salary object i have 2 custom fileds i.e number data type and In bankAccount object there is a custom filed called total_c 

when i am giving 20 and 30 in salaryobject then automatically updated in to bankaccount object i.e the result would  be shown in total_c =50 .So how can i do that let me know asap.

 

Thanks

 

sfdcfoxsfdcfox

Two basic ways to accomplish this:

 

1) Use a standard Rollup Summary field to sum up the value of Bank_Account__c.Total__c. This renders the field read-only and is automatically maintained by the system. Use this method if Salary__c.Bank_Account__c is a master-detail relationship field.

 

2) Use an Apex Trigger to calculate the value of Bank_Account__c.Total__c whenever a Salary__c record is created, modified, deleted, or undeleted. Use this method if Salary__c.Bank_Account__c is a lookup (detail) relationship field.

 

The exact method will depend on the design requirements of your application.