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)

Problem when accessing Data from url using javascript

(0) ShareShare
ReportReport
Posted on by 547

Can any one please help me get the data of given variables. I have seen many codes on Stack overflow and MSDN page but I could not frame a logic on my own. It's my lack of knowledge.

Any help would be great!!!

I have a URL as below

http://crm/<server name>/WebResources/abaxis_popup?Data=recordid%3dElectrolyte%26sometext%3daw_device%26somemoretext%3dpolyclinic

I have variables and data as follows

------------------------------------------------------------------------------------------

var addParams =encodeURIComponent( "recordid=" + entityLabel + "&sometext=" + entityName + "&somemoretext=" +entityId);
Xrm.Utility.openWebResource('abaxis_popup',addParams ,280,200);

------------------------------------------------

recordId=Electrolyte

sometext =aw_device

somemoretext=polyclinic

------------------------------------------------------------------------

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    You can use code provided here - a33ik.blogspot.com/.../howto-htmljs-webresources.html

  • chikhaleankush Profile Picture
    547 on at

    Thank you Andrii for your reply.

    Pardon me but I could not frame the function or logic.

    given the data above in my question how should i simply get 3 values in HTML.

    Again Excuse me this is my Lack of knowledge!!

  • Verified answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    1. Include ClientGlobalContext.js.aspx to script references in your html webresource.

    2. Use following code to get all parameters (including Data) from querystring:

    var parameters = GetGlobalContext().getQueryStringParameters();


    3. Add following function to parse Data parameter:

    function ParseData(query) {
        var result = {};
    
        if (typeof query == "undefined" || query == null) {
            return result;
        }
    
        var queryparts = query.split("&");
        for (var i = 0; i < queryparts.length; i++) {
            var params = queryparts[i].split("=");
            result[params[0]] = params.length > 1 ? params[1] : null;
        }
        return result;
    }

    4. Use function to parse parameters from Data:

    var customparams = ParseData(parameters.Data);
    var recordId = customparams.recordId;
    var sometext = customparams.sometext;
    var somemoretext = customparams.somemoretext;


  • chikhaleankush Profile Picture
    547 on at

    Thank you very much!!!

  • Peter Bohn Profile Picture
    on at

    Hi chikhaleankush and Andrii,

    is it possible with that, to use the otb-formular-Parameters, which can be defined in formular-customization in tab Parameters?

    If i understood right, in the form-customiz. Parameters i can set the Parameter names und types which can be received by this form.

    ... but how can i add this Parameters to URL.

    i wish to click f.e. on a subgrid plus to open a new quickform, and send different values from the form from which i clicked the add new to the quickform.

    I cant use the otb-mapping of the relationship, cause i Need to Control the params, which i send to the quickform.

    thx. greets PeB

  • chikhaleankush Profile Picture
    547 on at

    use in similar way

    -----------------------------------------------------

    var addParams =encodeURIComponent( "recordid=" + entityLabel + "&sometext=" + entityName + "&somemoretext=" +entityId);

    Xrm.Utility.openWebResource('abaxis_popup',addParams ,280,200);

    ---------------------------------------------------------------------

    get the parameters or any value from the Form using Javascript functions add them to addParams and either use then with on save or on change or create a HTML button and write function onClick of it.

    Hope this helps!!

    Regards,

    Ankush

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