You need to sign in to do that
Don't have an account?
John Neilan 2
Update Lookup Field with Text ID
Hello,
I have what I think is a very simple request, but I'm struggling with it. I have a custom field on the Case object called Account ID, which is a text field. I also have a field called Primary Account, which is a lookup field. I have a Google form integration that creates a Case when a form is submitted and populates the Account ID with the 15-character Account ID, input by the form submitter. I want to create a trigger to take that value and populate the Primary Account lookup field with the Account associated with the ID. Can anyone point me to code that can accomplish this? Thanks,
I have what I think is a very simple request, but I'm struggling with it. I have a custom field on the Case object called Account ID, which is a text field. I also have a field called Primary Account, which is a lookup field. I have a Google form integration that creates a Case when a form is submitted and populates the Account ID with the 15-character Account ID, input by the form submitter. I want to create a trigger to take that value and populate the Primary Account lookup field with the Account associated with the ID. Can anyone point me to code that can accomplish this? Thanks,
All Answers
If you do a trigger - then it'd have to be an after insert trigger. And then you'd have to update the record again.
If the account id exist in SF then it is simple just pass that id to Parent AccountID in before insert. Use try catch in case there is error or that Id in not available in SF.
You can use process builder also but since you asked for trigger
@Vivek - The ID does not exist on the Case until the Case is created, and it's created as a text value. I did try a Process, but it was not updating the lookup field.