web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

CRM 2011 call a workflow or dialog process from a custom button on the ribbon

(0) ShareShare
ReportReport
Posted on by

I have a custom workflow created to resolve a case w/out a popup and a dialog created to cancel a contract with specific termination questions. I would like to call these processes from custom buttons on the ribbon. Any assistance in both setting up the javascript to call the process and the specific settings necessary for the button to call the javascript would be appreciated.

The button calls the workflow however I get the error: Record Is Unavailable - The requested record was not found or you do not have sufficient permissions to view it.

Javascript to call the workflow

function callCloseContractDialog()
var a = new Array(crmFormSubmit.crmFormSubmitId.value);
var sIds = Xrm.Page.data.entity.getId()+";";
var sEntityTypeCode = "1010"; //Replace this with your entity type code
var sWorkflowId = "{073B4F2B-5DFC-407F-BADD-16521FB3E181}"; //Replace this with your actual workflow ID
var iWindowPosX = 500; //Modal dialog position X
var iWindowPosY = 200; //Modal dialog position Y

var oResult = openStdDlg(**ENTERED MY ORG NAME**("/_grid/cmds/dlg_runworkflow.aspx")+"?iObjType=" + CrmEncodeDecode.CrmUrlEncode(sEntityTypeCode) + "&iTotal=" +
CrmEncodeDecode.CrmUrlEncode(a.length) + "&wfId=" + CrmEncodeDecode.CrmUrlEncode(sWorkflowId)+ "&sIds=" + CrmEncodeDecode.CrmUrlEncode(sIds) , a, iWindowPosX, iWindowPosY);

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Gus Gonzalez Profile Picture
    27,113 on at
    Re: CRM 2011 call a workflow or dialog process from a custom button on the ribbon

    Jennifer,

    It is not finding the Workflow...have you tried not typing your Org Name?

  • Community Member Profile Picture
    on at
    Re: CRM 2011 call a workflow or dialog process from a custom button on the ribbon

    I have tried to edit out my name. I am now to the point that the following will call the dialog process however I receive an error: The URL you used to start the dialog is incorrect. Add a correct URL and try again. I do not see where the error is. My best guess is that it I must have something wrong in the syntasx to get the GUID of the current contract.

    function callCloseContractDialog()
    {
    var contractIDValue = Xrm.Page.data.entity.getId();
    window.open("http://server:port/organization/cs/dialog/rundialog.aspx?DialogId=%7b073B4F2B-5DFC-407F-BADD-16521FB3E181%7d&EntityName=contract&ObjectId=contractIDValue");
    }

  • Community Member Profile Picture
    on at
    Re: CRM 2011 call a workflow or dialog process from a custom button on the ribbon

    This is the code that finally worked. You were correct on removing the org name.

    function callCloseContractDialog()
    {
    var contractIDValue = Xrm.Page.data.entity.getId();
    window.open("/cs/dialog/rundialog.aspx?DialogId=%7b073B4F2B-5DFC-407F-BADD-16521FB3E181%7d&EntityName=contract&ObjectId= "+ contractIDValue");
    }

  • KEdwards Profile Picture
    30 on at
    RE: CRM 2011 call a workflow or dialog process from a custom button on the ribbon

    there is no way that code worked...  you have a " after a variable... making it syntactically incorrect.  

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#1
UllrSki Profile Picture

UllrSki 2

#3
ED-30091530-0 Profile Picture

ED-30091530-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans