Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Error when calling dialog from js

Posted on by Microsoft Employee

Hi ,

I got an error 'wrong url' when calling my dialog from js function.

function callDialog(dialogId, entityName, objectId) {

{
var url = Xrm.Page.context.getClientUrl() + "/cs/dialog/rundialog.aspx?DialogId=" +"7bA092EA24-6246-4F32-9341-4AB11A5077E9"+ "&EntityName=" +entityName + "&ObjectId=" +Xrm.Page.data.entity.getId();
window.open(url);
}

Any suggestions,

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Error when calling dialog from js

    Hi Arun & Leo ,

    Thank you for your replies .

    I did use the call process : 

    Process.callDialog(DialogId,
    EntityName,
    EntityId,
    function () {
    Xrm.Page.data.refresh(false);
    }, null);

    and it's working fine .

    Thank you both for your help.

  • Verified answer
    LeoAlt Profile Picture
    LeoAlt 16,329 on at
    RE: Error when calling dialog from js

    Hi partner,

    Before you call your dialog, please press F12 and open Developer Tools.

    Then after you call your dialog, you can find the request record bellow Network section.

    WeChat-Screenshot_5F00_20181008111059.png

    You can get your full url from Request URL

    I suggested that you can enter the full url in your browser and check if there is a problem with your url, for example, is your physical path correct?

    You can also determine the source of your issue from Status Code.

    Hope it helps.

    Best Regards

    Leo

  • Verified answer
    Arun Vinoth Profile Picture
    Arun Vinoth 11,613 on at
    RE: Error when calling dialog from js

    Try this instead:

    "org/cs/dialog/rundialog.aspx?DialogId=%7bA092EA24-6246-4F32-9341-4AB11A5077E9%7d&EntityName=quote&ObjectId=%7bEA21842C-8EC1-E811-8145-5065F38A3901%7d"

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Error when calling dialog from js

    Hello Arun ,

    Thank you for your reply ,but still had the problem.

    When i debug on url  (window.open(url)) i found :

    "org/cs/dialog/rundialog.aspx?DialogId={A092EA24-6246-4F32-9341-4AB11A5077E9}&EntityName=quote&ObjectId={7bEA21842C-8EC1-E811-8145-5065F38A3901}"

    still have the braces.

    any idea why?

  • Suggested answer
    Arun Vinoth Profile Picture
    Arun Vinoth 11,613 on at
    RE: Error when calling dialog from js

    Curly braces {} around guid will be encoded as %7b and %7d. While copying/typing your record guid you did a typo. Guid should be 36 digits with 4 dashes and 32 chars. Try the below:

    If you debug this both dialog Id & object Id should be having that proper guids.

    function callDialog(dialogId, entityName, objectId) {

    {

    var url = Xrm.Page.context.getClientUrl() + "/cs/dialog/rundialog.aspx?DialogId=" +"{A092EA24-6246-4F32-9341-4AB11A5077E9}"+ "&EntityName=" +entityName + "&ObjectId=" +Xrm.Page.data.entity.getId();

    window.open(url);

    }

    [View:https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/open-forms-views-dialogs-reports-url#opening-a-dialog-process-by-using-a-url]

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,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans