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
himanshu huske 7himanshu huske 7 

Trigger Task On Account

I have Account, Opportunity and Application Object.
Application is child to account, Application has picklist field status__c
if, Application Statas__c ='inProgress' , Account and Opportunity records should get locked, 
if status=='InProgress' records should get unlock.
RituSharmaRituSharma
Does locking means that user should not be able to edit Account and opportunity records? What if account has multiple applications and one is in progress and others are not?
himanshu huske 7himanshu huske 7
yes,
We should not able to update account and opportunity record
himanshu huske 7himanshu huske 7
account has only one application
 
RituSharmaRituSharma
Create rollup summry field on account to store no. of In Progress applications(may be one only). Create validation rule on account and opportunity objects and check the value of rollup summary field of account. If it's 1, throw error.
himanshu huske 7himanshu huske 7
I want to do this through trigger.. please provide code