load() function causing error when it is not used

I got this error when none of the interfaces or expression rules mentioned use the load() function, they all use a!localVariables(). Does anyone know why this error could still be appearing?

"Interface Definition: Expression evaluation error ... The load() function cannot be used within rules called by looping functions other than a!forEach(). Pass the necessary variables via rule inputs or use a!forEach()."

  Discussion posts and replies are publicly visible

Parents Reply
  • 0
    Certified Associate Developer
    in reply to alex.ladue

    I just spent  a whole day tracking down and coding around this strange bug :-(

    It is actually possible to have foreach() in a function (expr. rule) called by a function using reduce(), as long as this topmost function is not called from an interface. My workaround was to move some code (including the call of the topmost function) out of the interface and into a script task.

    I strongly suggest that Appian remove this strange limitation - and while they are at it: Introduce tail recursion optimization, so that we (developers) can skip the reduce() in favor of recursive functions: Most of the time reduce() is an acceptable substitute for recursion, but when the number of iterations (recursions) is not known in advance, it is inadequate.

Children