Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Get OpportunityID GUID in web resource

Posted on by Microsoft Employee

Hi all,

I'm aware of some restrictions on doing this and also that Xrm.Page is going to be deprecated, however....

My question is why does it include the {} in the GUID when it returns the string??

Eg When I call this inside my JS

parent.Xrm.Page.data.entity.getId();

The value is a GUID but formatted as {GUID}

*This post is locked for comments

  • Suggested answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: Get OpportunityID GUID in web resource

    Hi,

    I am also agreed with you. But seems this due to maintain the structure and JSON serialization.

    You may noticed while we are passing GUID inside FetchXML we have to provide GUID inside {} . In other hand while we are passing GUID inside WEB API query we are passing without {} .

    So there is no consistency but we have to maintain the way MS provided.

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Get OpportunityID GUID in web resource

    Hi,

    parent.Xrm.Page.data.entity.getId();

    The id parameter passed to the URL is the encoded id value for the record. In this example the id value is {899D4FCF-F4D3-E011-9D26-00155DBA3819}. The encoded version of the GUID substitutes opening and closing brackets “{” and “}” with “%7B” and “%7D”, respectively,

    We need to replace braces 

    var fcProfileId = Xrm.Page.data.entity.getId(); 

    fcProfileId = fcProfileId.replace('{', '').replace('}', '');

    Thanks

    Ridhima

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans