SBX - Search With Button

SBX - Forum Post Title

set a lookup field value

Microsoft Dynamics CRM Forum

Ahmad Saud asked a question on 10 Sep 2018 3:04 AM
My Badges

Question Status

Verified

dear all

i do have a workflow that creates two different entity records (RecA / RecB), and i want to set a lookup field value on RecA to contain the value of RecB.

please help.

thanks,

Reply
David Jennaway responded on 10 Sep 2018 3:55 AM
My Badges

This should be straightforward. If you create RecB before RecA, then in the 'Look for' drop-down list of entities on the RecA form, you should see an entry for RecB at the bottom of the list, under 'Local Values'

Reply
Ahmad Saud responded on 10 Sep 2018 4:36 AM
My Badges

Let me clarify more, when lead qualifies, it creates opportunity(RecA),and i have a workflow that creates RecB(custom entity) on creation of opportunity, now i need the lookup value of RecB to be placed on opportunity (RecA).

sorry for not elaborating enough right from the beginning.

thanks,

Reply
Ahmad Saud responded on 10 Sep 2018 4:36 AM
My Badges

thanks, Let me clarify more, when lead qualifies, it creates opportunity(RecA),and i have a workflow that creates RecB(custom entity) on creation of opportunity, now i need the lookup value of RecB to be placed on opportunity (RecA).

sorry for not elaborating enough right from the beginning.

thanks,

Reply
Goutam Das responded on 10 Sep 2018 5:20 AM
Suggested Answer
akhil t responded on 10 Sep 2018 10:09 AM
My Badges
Verified Answer

Hi Ahmad,

You cannot do this using oob workflow designer as there is no provision for updating 1:N entity records. Only N:1 can be updated. In the example you mentioned RecB is a lookup on Rec A which makes it 1:N from BtoA. You should leverage a custom way to do this.

Reply
Saddam Khan(Sam) responded on 10 Sep 2018 12:06 PM
My Badges

Hi Ahmad

As i understand you need to create a custom workflow activity. And you can achieve this scenario like Guid RecAguid=service.create(RecA);

Then assign RecAguid in lookup of RecB.

Reply
Ahmad Saud responded on 15 Sep 2018 12:11 PM
My Badges

Ho Goutam

field mapping did not work in my case.

one thing can be the reason behind this issue, is it possible to make one record a child for two parent records?

thanks,

Reply
Ravi Kashyap responded on 15 Sep 2018 8:03 PM
Verified Answer

Hi Ahmad,

Are you creating both the record at once from a workflow, if yes then you can achieve this without custom code. You need to create RecB first and then while creating RecA, set RecB from the dynamics values under local values (This would appear with teh name of step).

Even if you have are creating records separately, you could still update child records by using the Dyanamics 365 Workflow Tools -

github.com/.../Update%20Child%20Records.md

Hope this helps.

Reply
Ahmad Saud responded on 16 Sep 2018 7:57 AM
My Badges

dear Goutam

please email me privately on ahmadfl2000@hotmail.com , i have some business with you.

thanks,

Reply
akhil t responded on 10 Sep 2018 10:09 AM
My Badges
Verified Answer

Hi Ahmad,

You cannot do this using oob workflow designer as there is no provision for updating 1:N entity records. Only N:1 can be updated. In the example you mentioned RecB is a lookup on Rec A which makes it 1:N from BtoA. You should leverage a custom way to do this.

Reply
Ravi Kashyap responded on 15 Sep 2018 8:03 PM
Verified Answer

Hi Ahmad,

Are you creating both the record at once from a workflow, if yes then you can achieve this without custom code. You need to create RecB first and then while creating RecA, set RecB from the dynamics values under local values (This would appear with teh name of step).

Even if you have are creating records separately, you could still update child records by using the Dyanamics 365 Workflow Tools -

github.com/.../Update%20Child%20Records.md

Hope this helps.

Reply
Goutam Das responded on 10 Sep 2018 5:20 AM
Suggested Answer

SBX - Two Col Forum

SBX - Migrated JS