In Microsoft Dynamics CRM HTML web resource we have Xrm.Page.context parameter from where you can get different information about your CRM/Page etc…

image

This gives an impression that we will have access to all other XRM scripting properties like Xrm.Page.data etc… but that is not the case.

I was having requirement to get the record ID and found given msdn document. Which tells you can pass the records as parameters.

http://msdn.microsoft.com/en-in/library/gg309536.aspx#BKMK_PassingParametersToWebResources

How to Do It:

Go to Web resource Properties in form Editor, Select given check box.

image

You will be able to get the record id in URL.

Pre Check Box Checked

image

Post Check Box Checked (there is a whole lot of stuff as given in msdn)

image

Fetching Data from Query String GetQueryString(“id”) will give you the record id. Similarly you can fetch other values as well.

function GetQueryString(key) {
    var resourceUrl = document.location.href;
    var queryList = resourceUrl.split(/[?&]+/);
    for (i = 0; i < queryList.length; i++) {
        pair = queryList[i].split("=");
        if (pair[0] == key) {
            return pair[1];
        }
    }
}

Leave a comment

I’m Abhinav

Welcome to my Blog. I am a passionate architect and developer dedicated to creating innovative and user-friendly digital experiences. With a background in both design and development, I bring a unique blend of creativity and technical expertise to every project I undertake.

In addition to my technical skills, I have a keen interest in the latest industry trends and enjoy sharing my knowledge through blogging and speaking engagements. When I’m not coding or designing, you can find me exploring new technologies, reading about the latest in tech, or indulging in my love for music and travel.

Let’s connect