Setting Context Expressions
Use a PowerShell script to set a Context Expression on a Target Group.
Procedure
- Open a PowerShell script in the Run as an administrator mode.
- Go to modules\ContextExpressions.
- Run the following command:
where:.\set-context-expression.ps1 -cmsUrl http://localhost -targetGroupId tcm:123-456-256 -contextExpression "browser.vendor == 'Google'"Parameter Description -cmsUrlThe web address of the Content Manager Explorer. -targetGroupIdThe identifier of the Target Group on which a Context Expression will be set. It can be either TCM URI or WebDAV URL. -contextExpressionThe boolean JEXL Context Expression. (optional) -cmsUserNameThe username used for the authentication. (optional) -cmsUserPasswordThe password for the provided username. (optional) -cmsAuthThe authentication type; possible values are: Windows(default), andBasic.You can use the
Basicauthentication type, in case your Content Manager Server requires credentials other than Windows credentials.
- JEXL Context Expressions
In SDL Digital Experience Accelerator (DXA), Context Expressions must be valid boolean JEXL expressions.