Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested answer

How to retrieve GUID of record from URl through js code

(0) ShareShare
ReportReport
Posted on by 335

Hello

 when i open my webresource on click of button then I want to retrieve GUID of record from URL through js code..

Thanks & Regards

  • Suggested answer
    Naveen Ganeshe Profile Picture
    Naveen Ganeshe 3,393 User Group Leader on at
    RE: How to retrieve GUID of record from URl through js code

    Hello Yash,

    You can use below code snippet to get the ID from URL:

     

    const entityId = getUrlVars()["id"].replace('{', '').replace('}', '');
    
    function getUrlVars() {
        var vars = [], hash;
        var hashes = window.location.href.slice(window.location.href.indexOf('?')   1).split('&');
        for (var i = 0; i < hashes.length; i  ) {
            hash = hashes[i].split('=');
            vars.push(hash[0]);
            vars[hash[0]] = hash[1];
        }
        return vars;
    }

  • Suggested answer
    ajyendra Profile Picture
    ajyendra 1,732 on at
    RE: How to retrieve GUID of record from URl through js code

    I think It might not work in Microsoft Edge Browser .

  • Yash Trivedi CRM Profile Picture
    Yash Trivedi CRM 335 on at
    RE: How to retrieve GUID of record from URl through js code

    Hello Ajayendra I got it through this:

    window.top.opener.frames[0].Xrm.Page.data.entity.getId();

    for CRM above 2016 version :

  • Suggested answer
    ajyendra Profile Picture
    ajyendra 1,732 on at
    RE: How to retrieve GUID of record from URl through js code

    Hi Yash,

    Try this

    ribbonworkbench.uservoice.com/.../129783-pass-the-currently-selected-grid-row-s-to-a-custo

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,494 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans