USD – ClearDataParameter

Within Unified Service Desk (USD) for Microsoft Dynamics CRM 2016 data parameters are created whenever a CRM entity is loaded into a hosted control. Assuming you are familiar with USD you will already understand that we often refer to these actions in USD actions.

For example, [[contact.Id]] would return the GUID of the currently selected contact. Great!

There are however times when you might one to clear these parameters. Imagine, for example, that you use one hosted control to display several different entities. As the parameters are added to each time a new entity loads, at some point you may wish to clear out the existing data. Maybe each time the hosted control (tab) is closed.

In this post I will describe how you clear data parameters.

Firstly, you might not have the required UII Action. (In my solution it wasn’t present by default.) The action you need to create is called ClearDataParameter and this is linked to the global manager hosted control. So load you global manager and navigate to UII Actions.

In here you may find an action called “ClearDataParameter” already exists. If it doesn’t simply create one. (Accepting the default contents of all fields except the name of the action.

Now we have our action let’s look at what it does. Below you can see that I have shown my current data parameters in the debugger. Also notice that I have highlighted three lines, these parameters are present because I opened a hosted control called “Contact” containing the “contact” entity.

To clear out these data parameters I need to repeatedly call the ClearDataParameter action we just created. For ease I’ve shown how to achieve this in the debugger. You’d obviously create these as action calls and associated with a suitable event. Such as CloseActive on a tab or maybe on a SessionClose event.

Notice that I have selected the hosted control as my global manager and that the action is ClearDataParameter. Also notice that I have added “name=contact“. Here I am adding the name of the entity / hosted control found in the data parameters. To fully clear the contact information I need to fire the action three times, one for each of the collections of contact information. (so, contact,Contact and Contact#contact)

Take One!

Take Two!

Take Three!

After I have run the action three times (and refreshed my data parameters) you can see that the contact information has been cleared.

I hope you have found this post useful. (If not, when you hit a problem of a tab being closed but the parameters still being load keep this in the back of your mind, it will be useful then!) J

One thought on “USD – ClearDataParameter

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

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 )

Google+ photo

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

Connecting to %s