Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Pass parameter ribbon workbench - dialog startup

(0) ShareShare
ReportReport
Posted on by 600

Hi

I am trying to create a button with ribbon workbench that will open a dialog window.

I have followed this approach: https://community.dynamics.com/crm/b/mscrmcustomization/archive/2015/05/06/running-crm-dialog-from-custom-ribbon-button

But I have difficulties with the last step where I will pass the objectId.

ribbonpicture.png

Thanks for help 

*This post is locked for comments

  • Suggested answer
    Umer990 Profile Picture
    Umer990 46 on at
    RE: Pass parameter ribbon workbench - dialog startup

    PassParameter should be false to avoid the error you got.

  • Verified answer
    Joshua Wright Profile Picture
    Joshua Wright 410 on at
    RE: Pass parameter ribbon workbench - dialog startup

    change the FirstPrimaryItemId to FirstSelectedItemId from home or subgrid

  • martingr Profile Picture
    martingr 600 on at
    RE: Pass parameter ribbon workbench - dialog startup

    Hi and thanks. This works! but if I try to launch from view (mark a record and click button) it wont work. Any ideas how to fix this?

    Thanks

  • martingr Profile Picture
    martingr 600 on at
    RE: Pass parameter ribbon workbench - dialog startup

    Edit Found out to resize window

  • martingr Profile Picture
    martingr 600 on at
    RE: Pass parameter ribbon workbench - dialog startup

    Thank you so much Josh! I think it works now with the above javascript.

    Do you know how to change the window mode so it dosnt open in full tab, but in ModalDialog?

  • RE: Pass parameter ribbon workbench - dialog startup

    Hi Martin,

    Do you know Fiddler? www.telerik.com/fiddler

    Could you collect fiddler traces when you click the button?

    Would be helpful to understand the URL that CRM is trying to access.

    Cheers!

    Pedro Pisco

  • Verified answer
    Joshua Wright Profile Picture
    Joshua Wright 410 on at
    RE: Pass parameter ribbon workbench - dialog startup

    First thing to verify, the record you are running this from is created. If hitting this ribbon button on a new unsaved record you will get an error.

    Next try without the full url, so in your setup actually delete the blacked out code above.

    I had some issues with using the open url from the ribbon workbench so solved by creating a js function and using that as the command for the ribbon button.

    function openDialogProcess(dialogId, entityName, objectId) {
       var url = Xrm.Page.context.getClientUrl() +
        "/cs/dialog/rundialog.aspx?DialogId=" +
        dialogId + "&EntityName=" +
        entityName + "&ObjectId=" +
        objectId;
       window.open(url);
    }


    and then from the parameters pass the following:OpenDialogParams.PNGwith the string guid being the dialogid.

  • martingr Profile Picture
    martingr 600 on at
    RE: Pass parameter ribbon workbench - dialog startup

    Hi and thanks for answer. Yes that is correct. I get page with: an error has occured.

    Any other thoughts?

  • RE: Pass parameter ribbon workbench - dialog startup

    Hello Martin,

    As far as i can see, everything is fine, it should work. You have the CrmParameter with the ObjectId and the PrimaryItemIds. This will populate the ObjectId.

    Are you getting any error when clicking the button?

    Cheers!

    Pedro Pisco

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

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

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 231,409 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans
Liquid error: parsing "/globalsearch/?q=(NOBRIDGE)+ERROR++Error%3A+Native+module+RNFBAppModule+not+found.+Re-check+module+install%2C+linking%2C+configuration%2C+build+and+install+steps." - Nested quantifier +.