Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Issue with opening CRM form via URL

Posted on by 4,926

Hi,

I am trying to open a new entity form via an URL (via a button embedded in a webresource).

This is a part of my code:

 

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

var NumDepot = Xrm.Page.getAttribute("pb_num_depot").getValue();

var berichtURL = crm_url + "/main.aspx?etc=10024&extraqs=%26regardingobjectid%3d%257b" + depotId + "%257d%26regardingobjectidname%3d" + NumDepot + "%26regardingobjecttypecode%3dpb_depot&pagetype=entityrecord"

window.open(berichtURL);

Unfortunately the entity Id (var depotId) always contains { at the beginning and } at the end, so the URL can't be opened, since it would only expect the GUID without these special characters.

 

I already tried to append a string.replace like depotId.replace('{', '') or depotId.replace(/[{}]/g, ''), but this also didn't replace the {}

 

Any tip for me, how I will only get the GUID without {}?

 

thx a lot

Thomas

*This post is locked for comments

  • tpeschat Profile Picture
    tpeschat 4,926 on at
    RE: Issue with opening CRM form via URL

    Xrm.Utility.openEntityForm works like charm.

    Thx Thomas

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Issue with opening CRM form via URL

    And yeah, you are using incorrect url. Look at part %3d%257b. Try to remove 25 from it. Same for %257d

    Look at example: /main.aspx?etn=lead&pagetype=entityrecord&extraqs=ownerid%3D%7bB8C6E040-656E-DF11-B414-00155DB1891A%7d%26owneridname%3DMark%20Folkerts%26owneridtype%3Dsystemuser

    (msdn.microsoft.com/.../gg334375.aspx)

    So basically, replace('{', '') works good, just change url.

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Issue with opening CRM form via URL

    I recommend you to use Xrm.Utility.openEntityForm msdn.microsoft.com/.../gg334375.aspx

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