You need to sign in to do that
Don't have an account?
Need Help To Bulkify a Trigger
I created a trigger that outputs error if checkbox is true and no document is attached.
It's working great. However, I've read here that I should bulkify it so that I don't hit SOQL query limits.
I need help bulkifying the below code. Thank you :)
It's working great. However, I've read here that I should bulkify it so that I don't hit SOQL query limits.
I need help bulkifying the below code. Thank you :)
trigger ReportRequestTrigger on Report_Request__c (before update, after update) { for(Report_Request__c rr:Trigger.New) { if(rr.Will_Receive_Provider_Facility_Claims__c== TRUE) { LIST<ContentDocumentLink> attachments = [SELECT ContentDocumentId, LinkedEntityId FROM ContentDocumentLink where LinkedEntityId = : rr.Id]; if(attachments.size()<=0){ rr.adderror('You cant select "Will Receive Provider Facility Claims" without attaching a Zip Census'); } } } }
Try the below one:
Thanks,
Maharajan.C
All Answers
Try the below one:
Thanks,
Maharajan.C
Please use the below code:
Thanks,
Maharajan.C