web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

CRM2016 How to create an Entity Reference Lookup on-the-fly

(0) ShareShare
ReportReport
Posted on by 959

I have an entity form in CRM2016 which contains a entity reference lookup to another part of the system.

When creating a new record the information for the fields are obtained via a java-script based wizard that fills in all the fields on the users behalf. One of the fields it fills in is an entity reference lookup.

Sometimes the wizard needs to create a value in the entity reference lookup that we haven't previously captured before. Our form-based java-script handles all the code to populate the value on form, where we initially set the ID value to an empty guid (00000000-0000...)

The plan was to have a pre-create plug-in spot that an entity reference had a empty guid, and go and create the foreign entity record on-the-fly and then correct the references during the pre-create operation.

However, I forgot that on new record save events the entity reference lookup names are not propagated into the plugin, only the empty guid. So I cannot create the foreign record on-the-fly.

Before I open a large can of fudge! Is there a way to force an entity reference lookup value to be pushed into the plug-in, or is there a way of passing a parameter or message via java-script that the pre-create plugin can detect and act upon?

Many thanks

Steve

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    Create another field which will hold the name of that lookup, in the plugin, get the name and create the lookup record using that name. Set that name in the field using javascript.

  • Steve Le Monnier Profile Picture
    959 on at

    That's what I refer to as a large can on Fudge (aka plan b). Is there any other way of passing parameters into the plug-in via the form save event, other than hiding the value in another field?

  • Suggested answer
    ashlega Profile Picture
    34,477 on at

    Create that record in the form on-save using javascript? If plan b is a problem because of the required plugin modifications:)

  • Suggested answer
    Community Member Profile Picture
    on at

    In that case you can create an action and pass the value using JavaScript as an input parameter.

  • Steve Le Monnier Profile Picture
    959 on at

    Hi Vikas

    Many thanks for the post. Do you have a code snippet that you can share with the group?

  • Verified answer
    Community Member Profile Picture
    on at

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans