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)

Get OpportunityID GUID in web resource

(0) ShareShare
ReportReport
Posted on by

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

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at

    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

  • Suggested answer
    gdas Profile Picture
    50,091 Moderator on at

    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.

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