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

trigger to update a field in Account


Loyalty points field should be updated when a primary account's relation's balance changes. Suppose personA is primary account and personB is peraonA's relation. If personB's balance changes, personA loyalty points should be dynamically changed. Relaton between paersonA and personB is stored in object FamilyBanking__c.

Can this be achieved through trigger?  Any help will be greatly appreciated.


-- Thanks in Advance --



You can achieve it by trigger, I am sharing some sample code just for an idea ,this is not the exact code.

Please refer this code

trigger updatesomevalue on Account(before update) {
	Account accountList;
		accountList = [select,id Name,Loyaltypoints__c From Account where id = :act.FamilyBanking__c];
		accountList.Loyaltypoints__c = act.Balance__c + some value;//append your logic here of dynamic changes
		//if your dynamic calculation is not based on Balance__c then write logic inthis way
		If(Trigger.old.Balance__c !={
			//write your logic
	upsert accountList;

 If this post answers your questions, please mark it as solved and give kudos if this helps you