You need to sign in to do that
Don't have an account?
notes and attachment validation
I am having the notes and attachments section as a related list on a custom object,
on save i have a trigger which is firing a approval process on my customobject
my scenario is when no record is attached under notes and attachment it should throw an error befre save "please enter value for notes and attachment" preventing the approval process not to fire
if attachment is present then no error should be thrown and record can be saved
can a validation rule help on this case
let me know how to do it
below is my trigger for approval process
trigger SubmitForApproval on Special_Programs_ADR_Exception__c (after update, after insert) { try{ for (Integer i = 0; i < Trigger.new.size(); i++) { if (Trigger.new[i].RoutenotifytoSalesSpecialist__c !=null && Trigger.new[i].DOSUser__c !=null && Trigger.new[i].RVP_Approver__c !=null) { // create the new approval request to submit Approval.ProcessSubmitRequest req = new Approval.ProcessSubmitRequest(); req.setComments('Submitted for approval. Please approve.'); req.setNextApproverIds(new List<Id>{trigger.new[i].ownerId}); req.setObjectId(Trigger.new[i].Id); // submit the approval request for processing Approval.ProcessResult result = Approval.process(req); // display if the reqeust was successful System.debug('Submitted for approval successfully: '+result.isSuccess()); } } }catch(System.DMLException e) { } } |
Thnks in advance
Then depending on checkbox is checked or unchecked you can have validation rule to add error message before approval.
Thanks,
N.J
can you help me with the trigger based on notes and attachments
Thanks,
N.J