tvavrda
(Tomáš Vavrda)
April 22, 2026, 3:28pm
1
When using Client Script to invoke a custom script action after executing a workflow action, and setting a condition using Rule, I expect the rule to evaluate the data after the action was performed.
Instead the rule accesses data at the right time (after action) but in the state of before the action was executed.
SecurityManager.GetAuthorizationProvider();
if (!authorizationProvider.Authorize(SecurityManager.CurrentPrincipal, scriptCall.Roles))
{
return false;
}
// check business rule
if ((scriptCall.Rule != null) && (processData.Action.Mode != PanelActionMode.Always))
{
RuleEngine ruleEngine = RuleEngine.Create(new Hashtable(), null);
XmlContainer rowXml = DatasetTools.GetRowXml(
processData.SelectedRows[0],
DataRowVersion.Current
);
object result = ruleEngine.EvaluateRule(scriptCall.Rule, rowXml, null);
if (result is bool)
{
return (bool)result;
}
throw new ArgumentException(
Origam.Workflow.ResourceUtils.GetString("ErrorResultNotBool", scriptCall.Path)
The reason is that SelectedRows is an array to which rows are copied before executing the action:
ExecuteActionProcessData processData = new ExecuteActionProcessData();
processData.SessionFormIdentifier = sessionFormIdentifier;
processData.RequestingGrid = requestingGrid;
processData.ActionId = actionId;
processData.IsModalDialog = this.sessionStore.IsModalDialog;
processData.Entity = entity;
processData.SelectedIds = selectedIds;
processData.Type = (PanelActionType)Enum.Parse(typeof(PanelActionType), actionType);
SessionStore sessionStore = sessionManager.GetSession(new Guid(sessionFormIdentifier));
processData.DataTable = sessionStore.GetDataTable(entity, sessionStore.Data);
processData.SelectedRows = sessionStore.GetRows(entity, selectedIds);
processData.ParameterService =
ServiceManager.Services.GetService(typeof(IParameterService)) as IParameterService;
if (
(processData.Type != PanelActionType.QueueAction)
&& (processData.Type != PanelActionType.SelectionDialogAction)
)
{
// get action
processData.Action = UIActionTools.GetAction(actionId);
// retrieve parameter mappings
We need to re-evaluate the data and pass the current state before evaluating Client Script rules.