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 365 | Integration, Dataverse...
Suggested Answer

Using Javascript, how does someone check which entity a new record was created from?

(0) ShareShare
ReportReport
Posted on by 67

Hello CRM Community,

If I'm not mistaken, Microsoft has deprecated the getQueryStringParameters() function in the new UCI, and I need help figuring out how to update our method to work with UCI.


BACKGROUND:

From an Entity A form, I am creating a new Entity B record (see Fig. 1 directly below)

Fig 1.

pastedimage1571769013598v1.png

Currently, we're using the following function to check which entity Entity-B was created from, but like I mentioned, this does not work anymore in the new UCI:

var createFrom = Xrm.Page.context.getQueryStringParameters()._CreateFromType;




QUESTION:

After clicking "New" and I'm on a new Entity B form, using the execution context passed via the event handler on a form (see Fig. 2 below), how can I retrieve the ID and Name of the entity from which Entity B was created? (This is a JavaScript web resource function that will be triggered when the new Entity B form is loaded -- onLoad) 

pastedimage1571769013598v2.png

I could really use the community's help. Thank you in advance!

Much appreciation,

Daniel

I have the same question (0)
  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    Hi,

    Try Xrm.Utility.getGlobalContext().getQueryStringParameters();

    querystring.png

    hope this helps.

  • LeoAlt Profile Picture
    16,331 Moderator on at

    Hi partner,

    You could use "Xrm.Utility.getGlobalContext().getQueryStringParameters()" instead.

    BTW, Microsoft also mentioned that we could use "formContext.data.attributes" instead.

    https://docs.microsoft.com/en-us/power-platform/important-changes-coming

    pastedimage1571796535464v1.png

    Hope it helps.

    Best Regards,

    Leo

  • DK123 Profile Picture
    67 on at

    Thanks for your response Ravi.

    Microsoft docs say that getQueryStringParameters() is deprecated. I tried Xrm.Utility.getGlobalContext().getQueryStringParameters(); and although I get the correct value in the Classic UI and the browser's dev tool console, UCI displays null/empty values which is not the expected values I see in ClassicUI and browser console.

  • DK123 Profile Picture
    67 on at

    Hi Leo,

    Thanks for your response.

    I'll try formContext.data.attributes since getQueryStringParameters() function has been deprecated even though Xrm.Utility.getGlobalContext() is valid.

    I'm struggling with how to retrieve the attribute value _CreateFromType via formContext.data.attributes. I'll keep trying and update this post when I figure it out.

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 365 | Integration, Dataverse, and general topics

#1
Martin Dráb Profile Picture

Martin Dráb 45 Most Valuable Professional

#2
iampranjal Profile Picture

iampranjal 36

#3
Satyam Prakash Profile Picture

Satyam Prakash 31

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans