You need to sign in to do that
Don't have an account?
bdardin
retreiving custom object type from what field
I wanted to build a simple trigger on the Event that would make a checkbox true if the What field looked up to one of our custom objects, and false otherwise. But with my attempt at this, it keeps making the checkbox true regardless of what is related to the event and I don't understand why. Here's the code:
trigger WorkOrderCheckbox on Event (before insert, before update) { for(Event newEvent : trigger.new) { if(newEvent.What instanceof SVMXC__Service_Order__c) { newEvent.Work_Order__c = true; } else { newEvent.Work_Order__c = false; } } }
What am I doing wrong here?
Try this:
All Answers
Try this:
Thank you so much, this worked! Now to study this to figure out why this worked and the other didn't...
In order to avoid govern limit, it should be like this,
Sorry, Like this,