You need to sign in to do that
Don't have an account?
suneel.patchipulusu@gmail.com
for (SObject obj: Trigger.new)?????
Hello all
Couls any one tell me what the SObject obj does??
According to my understanding:
NOrmally SObject is an generic object and Account,Pricebook,Product,customObject__c are concrete objects
Trigger.New is used for to chnage the field values in that particular Object.
Below event I didnt undertstood what the flow is??? Could any one can explian??
This event fires beforeinsert
for (SObject obj: Trigger.new)
{
Account a = (Account)obj;
if (// condition)
{
// code
}
Thanks in advance
I don't know why anyone would write the code this way, but it is perfectly valid code. Basically, they're casting Trigger.new into a List<SObject>, then casting each element (obj) into an Account SObject. In this case, you could remove that double casting:
Code like this might be useful if you didn't know for sure what type of SObject you might be dealing with: