adding CRMParameter to dialog URL

Sep 5, 2013 at 4:32 PM
Hi,
I'm trying to run a dialog from a button on the contact ribbon. I want to get it to pass the guid of the contact record into the dialog url but i'm unsure how to do this.

I have the url
http://sp-crm01/DEVCRM/cs/dialog/rundialog.aspx?DialogId=FCDE4D9A-3553-4EA1-B261-103FA0FF0DEE&EntityName=contact&ObjectId=

But i need to add the parameter to the contact ObjectId= on the end. In the ribbon editor i have added a Crm Parameter called guid with the value FirstPrimaryItemId but i don't know how to actually add this to the url

what do i do?

cheers
Craig
Developer
Jan 10, 2014 at 9:29 AM
Edited Jan 10, 2014 at 9:30 AM
Sorry for the late reply.
Generally, in this case I would suggest using JavaScript function and open the window from it passing the ID parameter. I don't think it is possible via Url feature.

As for your need, this is the function I used for running Dialogs from entity form. If you want to use it in grids, you will need to adapt it a bit.
RunDialog = function (dialogId)
{
    if (!dialogId) throw new Error('Dialog ID is not specified');
    if (!Xrm.Page.data.entity.getId()) throw new Error('Unable to determine record ID');
    if (!Xrm.Page.data.entity.getEntityName()) throw new Error('Unable to determine entity name');
    var lookupItems = new Object();
    lookupItems.items = new Array();
    lookupItems.items[0] = new Object();
    lookupItems.items[0].id = dialogId;
    return Mscrm.FormAction.runDialog(lookupItems, Xrm.Page.data.entity.getId(), Xrm.Page.data.entity.getEntityName());
}
Marked as answer by EvgenijM on 3/10/2014 at 8:11 AM
Mar 3 at 5:37 PM
Edited Mar 3 at 5:38 PM
In this same vein, I'm looking to pass a field to the end of the URL like described above, but to a URL outside of CRM.

For Example, let's say the field is "new_car" and I want to append it to the end of the link: "https://www.google.com/#q="

So, the button would launch a new tab off the contact record with the full address being "https://www.google.com/#q=prius*"

Ideas on how to achieve this?