I have often wanted to control which form the operators use in Unified Service Desk (USD).

For example, you might create a form which has been tailored to support the logging of cases on the phone. And therefore you want to “force” all USD operators to have this form when they are following a particular agent script.

I created the code below this morning, which It think will do the job. At the moment I have only implemented this by calling the code directly in the debugger. When I get a spare minute I will implement this concept from an agent script and document more fully.

Use the RunXrmCommand action to trigger the code.

My code was …..

var formType = Xrm.Page.ui.getFormType();
var currentForm = Xrm.Page.ui.formSelector.getCurrentItem().getId();
var newForm = "USD Main";
var forms = Xrm.Page.ui.formSelector.items.get();
var i = 0;
for(i=0; i<forms.length; i++) {
            if (forms[i].getLabel().toLowerCase() == newForm.toLowerCase()) {
                if (currentForm != forms[i].getId()) {
                    forms[i].navigate();
                }
}
}

I ran this in the debugger it looked like this …

ScreenChange1

Then the account form I had loaded changed to “USD Main”, shown below;

ScreenChange2

One response to “USD – Select Forms”

Leave a comment

Trending

Website Powered by WordPress.com.