Hi,
I've got a Dom action script that should handle most of the paths without interaction. However when it runs into an issue with validation for instance it should throw an popup to the user explaining what is wrong.
How can i configure/execute this action?
![](https://community.dataminer.services/wp-content/uploads/wp-user-manager-uploads/2020/10/nomnom.jpg)
Hi Gerwin,
If I understood the question correctly, you have a validation DOM action script that needs to show an interactive UI when there is an issue. But, you would also like to trigger this action in another script using the DOM API? (In which case, you don't need the interactive window, but just some output stating whether the validation passed or not)
Unfortunately, you can only have an action that is always interactive or never interactive.
Workaround 1: Use a standalone validation script
You could have a validation script that outputs the result using the 'Script Output' feature and call that one in the other script & DOM action script.
Workaround 2: Use two actions with one script and the 'IsInteractive' field
If you however want to use DOM actions exclusively for the validation, you could create a script with the DOM action entry point. Do the validation and if there is an error use the 'engine.IsInteractive' field to check if you need to add the errors to the script output, or show a UI. You can then create two DOM actions on your DomBehaviorDefinition, one with the 'IsInteractive' true and one with it set to false. The button can then be linked to the interactive action, and your scripts can trigger the non-interactive action. See this screenshot of an example that does seem to work:
The 'TryValidate' method accepts the DOM instance ID, retrieves the DOM instance and checks if all fields are correct. If there is an issue, it will return false and populate the 'errorMessage' with details on what is wrong. We then check if the script is interactive. If not, we just add the error to the 'error' key in the script output. If it is interactive, we build a UI with the error and show it. Do note that this example uses the UIBuilder to keep it short, but we do recommend using the IAS toolkit to build a nice UI.
Let me know if something would not be clear, or if I misunderstood your issue.
I see that this question has been inactive for some time. Do you still need help with this? If not, could you select the answer (using the ✓ icon) to indicate that the question is resolved?