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
Can you perhaps provide some more detail about a rule that's experiencing this? Is it happening in cases where there's a big nested hierarchy, or in relatively simple rules too?
You know, I have seen this error before but haven't been able to replicate (or find) today. My setup did not contain any load() calls either, however little jostling of the code got rid of it. Very interested for a code snippet if you can provide, and I wouldn't be surprised if we could dig a bug out..
just as basic idea: does any of your called expression rules or interface components have any load?
Now that I think more on it, I think I may have seen behavior like this once when there was a localVariable configured to have "refreshOnReferencedVarChange" turned off (which makes it essentially like a load() variable)... of course I have no proof of this.
Yea, it is definitely something in that realm.. I can't seem to reproduce however, will need that code snippet to identify..
This is a bad error message, but I'm pretty sure the cause of it is usually using the function a!forEach inside of another looping function like reduce(). Any chance you are doing that?
Yes exactly the same I am doing using a!foreach inside reduce fn. At expression rule level it is working fine but as soon as I implement it to main rules it is giving error on UI. So any solution for it to overcome this issue. I tried using a!refreshvariable and refreshalways as true but sill same issue.
Any help would be appreciated
a!forEach unfortunately cannot be used inside of reduce. Instead of a!forEach, you'll have to use fn!apply(),
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.
I agree that this bug should be removed. It makes it extremely difficult for the beginners.
BTW, Appian supports recursion.