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
kenny ellekenny elle 

Hi i need to automatically update the opportunity status to pending when at least one related account is submited for approvalccount

Hi i have a opportunitytype and accounttype objects.
i need to automatically update opportunitytype status=pending when atleast one related accounttype is submitted for approved. 
AnudeepAnudeep (Salesforce Developers) 
You can look at the sample trigger code here and make changes as per you need
kenny ellekenny elle
Hi Anudeep,
Cant we achrive this using workflow rule.
AnudeepAnudeep (Salesforce Developers) 
Through Apex, we can check if a record is submitted for approval using
Approval.isLocked(recordId);

I checked if it is possible to do the same thing using workflow rules and guess we can do that by creating an additional Checkbox Field [Is Locked(Is_Locked__c)] on the object and then in the Initial Submission Actions, you can add a Field Update that sets the field to TRUE and also in the Final Approval and Final Rejection action you will have to another Field Update that sets it to FALSE.

I haven't tried it myself but it looks like it can be done through workflow rule