You need to sign in to do that
Don't have an account?
Scott2014
How to use a workflow/trigger to update Lookup field
I am attempting to create a workflow/trigger that will update a lookup field with information that comes from a text field when the lookup field doesn't match or is blank. I read that this is not possible via workflow rule but not 100% sure that is accurate.
FYI - I have no experience creating a trigger but would like to learn. This is also my first discussion posting :).
Anyone thoughts or suggestions ?
FYI - I have no experience creating a trigger but would like to learn. This is also my first discussion posting :).
Anyone thoughts or suggestions ?
In the below trigger
** Accountid_text__c is a custom text field on Travel__c custom object that holds the account id value
** Account__c is a custom lookup field
trigger Travel33 on travel__c (before insert,before update) {
for(travel__c travels:trigger.new){
if(travels.accountid_text__c!=null){
travels.account__c=travels.accountid_text__c;
}
}
}
Hope this helps !!
So, I am trying to create a trigger on the Account record in which the NAICS Code (field name: NaicsCode - from Data.com) updates our custom object NAICS (field name: NAICS_Code__c) anytime the custom object field is blank or different than what Data.com text field indicates.
Does the below seem like it would work? If not, can you point out where it may be incorrect? It probabaly needs another if statement if they aren't equal, correct?
trigger NAICS on Account (before insert,before update) {
for(NAICS_Code_C naics:trigger.new){
if(Naics!=null){
Account.NAICS_Code__c=Naics;
}
}
}