I want to be able to take the child record id look up the parent id and take this parent id and save it into the lookup field for the parent, for illustration: a case with account lookup and asset lookup, need to be able to lookup the asset, then when asset is selected set the account id to that of the account id that the asset id belongs to. Would I need to create an update trigger, if so, is there any sample code I can use? Would a flow work, where the user selects the asset and then sets the account? Would a workflow work? - I don't think so as there doesn't seems to be any way of updating the account id on the case via a field update.

Here is an illustration of what I mean.enter image description here

  • 2
    I wonder if a quick sketch would help illustrate what you want in this case... Sep 12, 2014 at 8:15

2 Answers 2

  • Workflow with field update won't do the trick, you can't update lookup fields through field updates
  • Visual flow: in short, you need a record lookup where, in your case, you query the Asset, store the AccountId in a variable, and do a record update on the Case record
  • Trigger: possible as well

Only trigger is working. Maybe you can find the answer to your question on the thread below (code example):

Trigger to autopopulate a lookup field via related record

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .