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)

Passing custom parameters to a web resource in v9

(0) ShareShare
ReportReport
Posted on by

I'm running Dynamics 365 v9, and can't pass parameters to a web resource embedded in a form.  I've tried the methods shown in these links:

http://butenko.pro/2015/03/01/howto-htmljs-webresources/

https://msdn.microsoft.com/en-us/library/gg327945.aspx

I have added "test=testValue1" to the custom parameter box in the web resource, but, when I call "GetGlobalContext().getQueryStringParameters()" or "location.search()", my result contains only the appId parameter from the parent windows URL.  Am I misunderstanding something?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    Hi Sheltam,

    Based on Microsoft documentation there is no getQueryStringParameters anymore.

    The getQueryStringParameters has been replaced by formContext.data.attributes:

    The formContext.data.attributes API will make retrieval of non-entity bound data consistent across entity forms, metadata-driven dialogs, and task-based flows. The data will be a combination of custom values sent using the query string and what was specified in the parameters in the openForm method.

    Hope this helps.

  • Community Member Profile Picture
    on at

    Hey Aric,

    Thanks for the response.  I'm not sure how to get the formContext from a Web Resource.  I know on normal form fields you can check a box to pass in the execution context, and then retrieve the formContext from that, but there is no similar capability on a Web Resource.  

  • Verified answer
    Mahendar Pal Profile Picture
    45,095 on at

    Hi,

    For html webresource you should be able to use global context

    docs.microsoft.com/.../getglobalcontext-clientglobalcontext.js.aspx

  • Verified answer
    Preeti Sharma Profile Picture
    2,678 on at

    Hi,

    try writing following script to get global context in html webresource:

    var context=window.parent.Xrm.Utility.getGlobalContext();

    Hope this helps:)

  • Community Member Profile Picture
    on at

    Thanks Mahender and Preeti,

    That got me to where I needed to be.  After getting the GlobalContext I was able to call getQueryStringParameters() and bring back the custom parameter.  I'll have to check on whether getQueryStringParameters is being deprecated as Aric suggested.

  • Suggested answer
    Mahendar Pal Profile Picture
    45,095 on at

    Yes, it is depreciated, please check here: docs.microsoft.com/.../important-changes-coming

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