How to check if an USD Hosted Control exists before using it

429 Views Asked by At

I am working on a CRM/USD project (CRM 2016 on-premise with USD 2.2). I have a request for which I need to check to see if a hosted control already exists before using it in an Action Call.

I have tried things like [[hosted control name]] == "" or [[hosted control name]] == null (with and without the "+" and "g" keys) but none is working.

Any help is appreciated.

2

There are 2 best solutions below

0
On

In your condition, use double quotes, the '+' modifier, and the hosted control parameter that indicates whether the control is "open" or "closed", which is "HostedControlStatus".

It should look something like this: "[[Hosted Control Name.HostedControlStatus]+]"=="open"

0
On

You need to create a new action. Set the Hosted Control to "CRM Global Manager" and the action to "IsAppLoaded". In the data field, set the hosted control name as appname=Hosted Control Name.

Executing this action will put a value in the $Return variable (that you can see in your USD debugger). E.g. you will have $Return.IsAppLoadedNewActionName and it will say either "True" or "False" depending on

Run this action immediately before you try to check if the hosted control is open or not. Then, when you can use that result in the condition of your other action call. It should look something like "[[$Return.IsAppLoadedNewActionName]+]" == "True".