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”.

Xrm.Page.ui.tabs.get("stats").setFocus();
Xrm.Page.ui.tabs.get("stats").setDisplayState("expanded");

 

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");

7 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?

    Like

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

        Like

      • 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.

        Like

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s