USD – RunXrmCommand

In Unified Service Desk (USD) you can use the RunXrmCommand to interact with your CRM forms.

The example I’ve given below is an action call which will expand a tab on my forms called “stats”.



I have played around with other javascript, some things I expect to work don’t!

A couple of useful examples that do work include (I will add more as I confirm what works);

Display a notification in the notification bar.

Xrm.Page.ui.setFormNotification("Stats Opened", "INFO", "1");

Give an alert.

alert("Hello Stats");

11 thoughts on “USD – RunXrmCommand

  1. Pingback: Learning USD | My experiences with Microsoft Dynamics CRM

  2. Pingback: USD – The Book | Microsoft Dynamics CRM and Unified Service Desk

  3. Pingback: USD – The Book - Microsoft Dynamics CRM Community

  4. In the KM Control loaded in the USD, I want to filter the knowledge articles by language. I enabled the language filter. To set a language, I need to run a javascript. When I am running this in the IE developer tool console window it works. However when I run the same javascript using “RunScript” in the KB Search hosted control, nothing happens. Do you know any solution for this?


      • Thank you for a quick reply. I tried both RunScript and RunXrmCommand. Both does not work for “KM Control”.


      • I understand your issue now. Sorry, I didn’t click that you wanted to do this on the km control. I guess you already know that you can use SetSearchProps to enable the filter. But as far as I can see we don’t have an option to pick the language. To run Javascript on a crm form you’d use RunXrmCommand but the KM Control is not of type CRM Page. Therefore it seems that these commands aren’t working. (I haven’t tried this myself but that would seem a likely reason.) If my assumptions are right here you may find there isn’t a simple approach do achieve this with the KM Control. Sorry.


  5. Hi Neil,
    First of all, thanks for your blog and all your articles about certifications, they are amazing!

    I have a question, is there a way to fire a workflow from an Action Call in USD? probably using a RunXrmCommand action?

    Am I going crazy over here?



    • Thanks Jamie.

      I haven’t actually done this!

      But I would expect you can use a Process.callWorkflow command in a RunXrmCommand action.

      Have you tried that?
      If you continue to hit problems please send me a copy of your action and I will look deeper.




  6. Hello Neli,
    The V9 Client API uses the form context parameter (formContext) instead command (deprecated).
    How can I code Action Call script using V9 API Client for “CRM Page” hosted controls?
    If I use runXrmCommand action then how can i get that parameter? (“CRM Page” hosted controls)
    Also, by calling web resources (webResourceName) doesn’t work.

    Any Idea?

    Thanks Neil.


    • Don’t shoot messenger … with CRM Page on classic web client I am not sure you can. You need to use unified client and take the new approach to runxrmcommands. (Which doesn’t need is deprecated but I assume will always work with the classic web client. But we should expect to have to migrate to new unified client. And in that environment is not the long term / correct approach. So you need to move away from AND Classic web client.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s