Rule Event - Not working as expected

Certified Senior Developer

Appian 20.2 - on-perm

Had used a rule Event on a Process model , defined to call expression rule on it.

instance is broken with error " ERROR:EVAL:@reason=Rule XXX has invalid form, so cannot be evaluated.

refered to link https://community.appian.com/support/w/kb/1239/kb-1794-details-error-eval-reason-index-error-thrown-when-using-escalations-timers-and-exception-flows

and had removed all parameter names while calling the Expression rule.

  Discussion posts and replies are publicly visible

Parents
  • Can you add:

    • the code for the rule you're calling from the Rule Event
    • how you've configured your Rule Event

    then we have a better chance of diagnosing what's happening.

    Please use the "</>Insert Code" option when posting code

    thanks

  • 0
    Certified Senior Developer
    in reply to Stewart Burchell

    Rule event is configured on the Process model next to Synchronous sub-process

    Rule Event -> New Expression

    rule!expressionrulename(pv!parameter)

    expressionrulename is an query entity as below

    1 input parameter - datatype Integer

    code

    if(

    a!queryEntity(....).totalCount = 0,

    true,

    false

    )

  • Several things to observe/consider here:

    • What do you expect to happen if the expression returns false? There isn't anything that is going to cause the rule to be re-evaluated so your process is going to be suspended indefinitely (well, until Appian decides that it's been waiting too long for its own good!)
    • suspending a synchronous process whilst you're waiting for something that may not happen isn't a great user experience. You probably need to re-think your design
    • your code can be made simpler - a!queryEntity(....).totalCount = 0 is either true or false, you do not need to wrap it with an if() statement

    I would take a step back and try and articulate what you're trying to achieve with this pattern and see if there are other ways it can be achieved.

Reply
  • Several things to observe/consider here:

    • What do you expect to happen if the expression returns false? There isn't anything that is going to cause the rule to be re-evaluated so your process is going to be suspended indefinitely (well, until Appian decides that it's been waiting too long for its own good!)
    • suspending a synchronous process whilst you're waiting for something that may not happen isn't a great user experience. You probably need to re-think your design
    • your code can be made simpler - a!queryEntity(....).totalCount = 0 is either true or false, you do not need to wrap it with an if() statement

    I would take a step back and try and articulate what you're trying to achieve with this pattern and see if there are other ways it can be achieved.

Children