I recently explained how to use display multiple pages in a single tab in USD. Doing so is a neat and easy feature but depending on your solution you may now encounter a new challenge.
From time to time USD can get the data parameters currently available out of step with what the user is actually viewing. Using multiple pages is one example of when this can happen. As the data parameters will typically contain the details of the first contact selected not the contact currently being viewed.
In many interfaces this might not actually be a problem but if you have a toolbar that adds notes to the contact, looks them up on LinkedIn or shows a map (etc etc), then these functions would run on context of the first selected contact not the currently selected person. Not great!
But luckily the “ScanForDataParameters” action can come to the rescue. But it wasn’t as simple as I thought!
It is easy to create an action that calls “ScanForDatraParameters” which refreshes the parameters to match the currently selected record. I first tested his in the debugger and all was great. But when I added into my configuration I got unpredictable results. I found the problem was timing, sometimes the refresh of the parameters hadn’t finished before my next action fired. So I needed a way to pause before running the next action.
But luckily the “ExcecuteOnTimeOut” action came to the rescue.
Below is an example of how;
- Create a ScanForDataParameter Action.
- Create a ExecuteOnTimeOut Action.
- Add a sub action to the ExecuteOneTimeOut Action.
- Add the actions onto the toolbar.
Step One – Create a ScanForDataParameter Action.
Firstly, create an action call for this action. In my example, mine looked like this;
Step Two – Create a ExecuteOnTimeOut Action
Now you will need an ExecuteOnTimeOut action. Mine looked like the one below. I named it “Contact – ExecuteOnTimeOut (LinkedIn)”, as in this example I wanted to show how to “fix” my LinkedIn button. You will be applying this approach to any action you have.
The order I set was 15. You will see later that this is significant. I need it to fire AFTER the ScanForDataParameters action.
My hosted control is “Contact” and my Action is “ExecuteOnTimeOut”. You probably won’t have this action available to select! As it isn’t created for any hosted controls by default but can be added to any hosted control. So if you don’t have one simply add it.
Similar actions called “ExcecuteOnDataAvailable” and “ExecuteOnExpressionTrue” all so exist. You might want to research those!
The data portion defines how long you want to wait. I have selected “milliseconds=1000” to create a 1 second pause before my LinkedIn page loads.
Step Three – Add a sub action to the ExecuteOneTimeOut Action.
After saving the ExecuteOnTimeOut action, add sub action(s). These will be triggered when the timeout completes. These are typically going to be the actions you previously had in your toolbar button or agent script. So in my example I added an action to display a LinkedIn profile.
Now add these actions to each of your toolbar buttons (or agent scripts etc) that update the contact. For an example I have shown my toolbar button for LinkedIn. You add sub actions by selecting the “Sub Action Calls” option in the ribbon navigation.
Mine ended up looking like this;
Step Four – Add the actions onto the toolbar.
Now edit your toolbar button to call the ScanForDataParameters and ExecuteOnTimeOut actions you’ve just created.
You can see below that mine calls the “ScanForDataParaemters” action first, due to the order I gave each action. (This is important!)
FYI: If you’d like to copy my idea of a LinkedIn search for a contact you can see how I did it in this post.
If you are using multiple pages in USD and hitting problems like this I hope this post has been useful. J
One thought on “USD – ScanForDataParameters (AND ExecuteOnTimeOut)”
Pingback: USD – The Book | Microsoft Dynamics CRM and Unified Service Desk