function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Marco_MaltesiMarco_Maltesi 

tigger Validate before update!!

hello,

the idea is that the user can only modify records that he 's tha manager.

i try to write this trigger but it alaways gives error!

trigger

CraModifValidation onCra__c (beforeupdate) {

for

(Cra__c acc:trigger.new)

{

{

if

( getSObjects.Offre__c.Manager__c <> getSObjects.User.Id)

acc.addError( " you can t modify);

}

}

}

thanks for help

Suresh RaghuramSuresh Raghuram

first thing i need to know what the error is.

 

second thing why you open 2 flower braces

after for loop

for

(Cra__c acc:trigger.new)

{

{

if

( getSObjects.Offre__c.Manager__c <> getSObjects.User.Id)

acc.addError( " you can t modify);

}

}

 

make sure there is a space on Cra__c (beforeupdate)

If this answers your question make this as a solution.