Code :
a!buttonWidget( label: "Save & Exit", tooltip: "Click here to save the data & resume the task later", saveInto: { a!save(ri!Save,true),a!save(ri!Submit,false), a!forEach( items: local!samtask, expression: { if( isnull(fv!item.creationDate), a!save( fv!item.creationDate,today() ) , null ), if(isnull(fv!item.lastUpdateDate), a!save( fv!item.lastUpdateDate,today() ), null) , if(isnull(fv!item.createdby),a!save( fv!item.createdby,(user(loggedInUser(),"firstName")&" "&user(loggedInUser(),"lastName")) ), null), if(isnull(fv!item.lastUpdatedby),a!save( fv!item.lastUpdatedby,(user(loggedInUser(),"firstName")&" "&user(loggedInUser(),"lastName")) ), null), if(isnull(fv!item.comments) ,a!save( fv!item.comments,"Row created at CCA task interface by user" ), null) } ), a!save(ri!SamTask,local!samtask) }, submit:true, size: "STANDARD", style: "PRIMARY", disabled:and(a!forEach( items: local!samtask, expression: fv!item.istaskdone ))
ERROR : Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error [evaluation ID = 0IAGCEKD] : An error occurred while executing a save: Expression evaluation error: You must specify a variable to save into, such as ri!name << fn!sum. Received: List of Text String.
Kindly help me Thanks
Discussion posts and replies are publicly visible
The main issue I see is that you have a bunch of if() statements inside of your a!forEach() that resolve to either a save or null. Having null is not valid as a save - you must either return a variable, a!save() or an empty list. Can you try to swap out all the instances of returning null with {} instead?
I tried but still same error :(
Just curious - does it work without the a!forEach()? I'm wondering if you also have to somehow flatten the result of the forEach, since maybe it's returning a list of lists or something. For instance, you could try to use fn!reject to remove the empty lists or null values.
One other hacky way that I bet would work - you could also try to always save a value in each of the saves, but if the value already exists simply save the new value as the previous value. For example you could try this:
a!save( target: fv!item.creationDate, value: if( isnull(fv!item.creationDate), today(), fv!item.creationDate ) )