Compartilhar via


Use replacement parameters to configure Unified Service Desk

Replacement parameters can be used for customizing interactions during a specific business process through actions and window navigation rules. More information: Replacement parameters

This topic provides information about the replacement keys that you can use in your replacement parameters to indicate special handling how you can use the replacement parameters in Unified Service Desk in some special conditions.

In This Topic

Replacement keys

Specialized handlers

Replacement keys

The following table provides information about the replacement keys that you can use in your replacement parameters.

Replacement key Description

+

This key, when present, will replace a null or non-existent key with an empty string.

For example: In the scenario where account.Name is undefined, calling [[account.Name]] would result in a “not all replacement parameters could be replaced” error, which will stop processing on the rule or line item being executed.

However, [[account.Name]+] will return a blank, and not raise the replacement key error.

$

This key allows escaping of quotes and line breaks. It is generally used as an operator when invoking a scriptlet or returning a multi-line string.

For example: [[script.MyMultiLineString]$]

^

This key prevents escaping of quotes and line breaks, and is used to flatten multi-line result set.

For example: Mymultiline=[[myvalue]^]

u

This key is used to URL Encode (also called Percent Encode) the replacement parameter.

For example, consider the replacement parameter in the following URL: http://mysite?something=[[opportunity.name]u.

The following string is returned: http://mysite?something=My%20Opportunity.

x

This key is used to XML encode the replacement parameter. The enables the XAML characters, such as <, to be escaped and display properly in the output.

For example, [[myvalue]x].

g

This key is used to return the value from the global session. If the key cannot be found in the global session, it will result in a key not found error.

a

This key is used to return value from the currently active session that is in focus. If the key cannot be found in the active session it will result in a key not found error.

v

This key is used to replace keys within a replacement key.

For example, consider the following two values:

  • account.name = “My Account”

  • mytemplate.value = “My template is [[account.name]+]

When you invoke the [[mytemplate.value]], the following string is returned: “My Template is [[account.Name]+]”.

However, when you invoke [[mytemplate.value]v], the following string is returned: “My template is My Account”.

Specialized handlers

Often times, there is a need to do something simple, like an if/then/else type construct that does not warrant creating a scriptlet. These situations require using a scriptlet inside an action call. There are two specialized handlers to assist when building inline scriptlets in action calls: $Expression and $Multiline.

$Expression

Consider a situation where you need to switch display name based on the entity type code of the current entity. You are building a URL that needs this information. In this situation, there can only be either an account or contact loaded.

In this scenario, we are calling the Navigate action on the CRM Global Manger hosted control. We want to build the session from the current session, so we use the following in the Data field:

url= http://mysite/showmessage.aspx?displayname= {either the account or contact display name}

To achieve this, we will use $Expression as follows:

url= http://mysite/showmessage.aspx?displayname=$Expression(“[[$Context.etc]]” == “1” ? “[[account.Name]u]” | “[[contact.FullName]u]” )

This effectively creates and runs a scriptlet as the action is processed.

$Multiline

In the $Expression section, we talked about doing an inline scriptlet within an action. In the situation where there is a need to do a more complex scriptlet, and you still do not want to use a scriptlet object to store the scriptlet, the $Multiline command can be used to store more complex scriptlets.

For example, using the example we used earlier in the $Expression section, it can be broken out as:

url= http://mysite/showmessage.aspx?displayname=$Multiline( $Expression(
function doWork()
{
      If (“[[$Context.etc]]” == “1”)
          return “[[account.Name]u]” 
      else 
          return “[[contact.FullName]u]”
}
doWork(); 
))

See Also

Concepts

Replacement parameters
Execute scripts using scriptlets in Unified Service Desk

Other Resources

Unified Service Desk configuration walkthroughs

Unified Service Desk
Send comments about this topic to Microsoft.
© 2015 Microsoft. All rights reserved.