You need to sign in to do that
Don't have an account?
Apex developer 21
Create a trigger to remove create edit delete record on note record on cusom object on condition aproval is pending
Hi All, Please help!!
I need to create a trigger on a custom object with a related list note, where the create edit delete permission is removerd from the note record when the approval is set to pending. Could you help with an example and point me in the right direction. I have attached an example below to make thing clearer.
I need to create a trigger on a custom object with a related list note, where the create edit delete permission is removerd from the note record when the approval is set to pending. Could you help with an example and point me in the right direction. I have attached an example below to make thing clearer.
When the record is sent for an approval.. Status is pending and whomever submitted the record he/she can't edit it.
Right now, you are loggedIn as admin that's why you are able to edit it otherwise you won't be able to.
Try to do the following,
1) Try to submit the record for an approval from any other user besides system admin profile
2) See he/she can edit it during these pending seasion
3) Once approver approves the record then record is locked as well. If approver rejects it then record becomes unlocked. If approvers recalls it then it becomes unlocked. But as I said before, when submitter submits for an approval record automatically becomes locked.
Look for "Initial Submission Actions" under approval process, you will see that you cannot modify the Record Lock action.
Hope this helps!
caused by: System.QueryException: Implementation restriction: ContentDocumentLink requires a filter by a single Id on ContentDocumentId or LinkedEntityId using the equals operator or multiple Id's using the IN operator.: Trigger.Locked: line 3, column 1.
Here is my trigger:
Please help.
1) Create a two pagelayouts (Pg-1 & Pg-2) and one of them (Pg-1) have notes section visiable and on other one (Pg-2) make in not visiable.
2) Create a field on record named Approval_Status__c which has picklist values as New, Pending, Approved, Recalled, Rejected. Make sure your approval is updating an appropriate picklist value. (E.g., if it's pending then Approval_Status__c should be Pending - This can be accomplished right from Approval Process field update)
3) Your initial record type and pagelayout should be RT-1/PG-1 (This one has Nots section visiable).
4) Create a workflow which changes the record type and pagelayout to RT-2/PG-2 (the one doesn't have Notes section visiable) when Approval_Status__c is "Pending."
I am not 100% sure if this works out but this is what I can think of initially & There is one down side for this .. Which is approver won't be able to see the notes prior to approval since the status is pending and there is no related list of Notes. <-- Even this can be workout with profiles though..
Like.. if Approver is from different Profile then create an additional Page Layout PG-3 for them which has related-list of "Notes" will be visiable all the time.
Try it out if it works..