s = CS.UI.close(ʃresult := ... ‖ exception := ...ʅ)
| Argument | Description | Types / Required |
| result | The result to return. | string, number, boolean, array, object
not required |
| exception | An exception to throw. | string, object
not required |
Optional arguments allow you to pass information to the
execution environment that launched the dialog or web view. A
result can be provided, which serves as the return value for an action like
UI.showDialog.
Alternatively, an invalid state can be signified by returning an
exception, which will be thrown in the calling execution environment. This exception can be specified as a string containing the message text, or as an object in the format used by the
throwException action.
This action has an impact in the following scenarios:
The action returns a boolean value indicating if a dialog or web view successfully closed.
The action throws an exception if any of its arguments are not specified in a valid form.
<script>
const CS = new CSProActionInvoker();
CS.UI.closeAsync({
result: {
userName: document.getElementById("userName").value,
password: document.getElementById("password").value,
}
});
</script>
<script>
const CS = new CSProActionInvoker();
// ...
CS.UI.closeAsync({
exception: "Could not validate token."
});
</script>
try {
CS.UI.view({
path: "validate-token.html",
inputData: {
"provider": "...",
"token": "..."
}
});
}
catch(error) {
CS.UI.alert({
title: "Token Validation Error",
text: error.message
});
}