You need to sign in to do that
Don't have an account?
himanshu huske 7
basic triggers
Whenever a new transaction is performed successfully then update the customer object balance field based on
If Transaction Type=Deposit, Balance= balance +amount ; withdraw balance= balance-amount;
Note: Customers and Transaction has lookup Detail Relation.
If Transaction Type=Deposit, Balance= balance +amount ; withdraw balance= balance-amount;
Note: Customers and Transaction has lookup Detail Relation.
Before helping you out.Please correct me if I am wrong,
the customer object field which you are referring to update are balance and withdraw balance correct?
Thank You,
Abhishek Singh.
Customer is a parent object with Balance field.
Transaction_type is child object with fields customer(lookup), Diposit, Withdrawal.
with every deposit or withdrawal, balance field in customer object gets updated.
This can be achieved using Process Builder, there is no need to write trigger. Follow below mentioned steps to create one:
- Go to process builder under Workflows and Approvals. Create a new process and select start criteria as "When a record Changes".
- Click on Add Object and select Transaction__c. Also select the option "only when a record is created". Click save.
- Click on Add Criteria and select "No criteria—just execute the actions!", give it a name and click Save.
- Click on Add Action next to the condition. Action Type = " update records". In select a recod to update, select "Select a record related to the Transation". Then select "Customer".
- Select "Amount" field and then select type = "Formula". Paste this formula in the editor :
- Activate the process.
Please use the field names, Object names and relationship names which apply to your org. These are just assumptions.Click save.