USD – CopyToContext

This is a really quick post about Unified Service Desk for Microsoft Dynamics CRM.

An action I have used quite a bit recently has been CopyToContext, so in this post I will explain what it does and why you might use it.

CopyToContext is used to copy variables to the current context. I guess there is a clue in the name.

This can be very useful if you want to store something in the context that can be used later. There might be many situations when this could be useful. One example: You could might want to set a variable when an agent script has been run. (When I get a spare five minutes I will do a longer post maybe giving this as a detailed example.)

For now, I have shown below how in the debugger I can run a direct action. Notice that the hosted control is “CRM Global Manager” and that the action is CopyToContext.

That data portion then contains one (or more) name=value pairs. So in my example I have set a variable called TESTVARIABLE to Hello World. And a second variable to the full name of the currently selected contact.

Having run this action, if you refresh the data parameters you can then see the newly created variables under the context.

Now they are in the context you can use them as replacement parameters in any actions (etc) that you like. “[[$Context.TESTVARIABLE]]
will return “Hello World” in my example.

Any programmer will know that being able to display Hello World is obviously a powerful bit of code!

Well maybe not but hopefully you can see that this action might be very useful. J

3 thoughts on “USD – CopyToContext

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

  2. Thanks for the post.
    1. Can I copy a value into global context from session without using custom code.
    2. How can I get DateTime. Now in data parameter of an action without using script let which is being refreshed when session starts.

    Like

Leave a Reply to Madan Cancel 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 )

Facebook photo

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

Connecting to %s