I have a SAIL form that displays CDT data which ultimate came from a web service. There is a button on the interface to refresh the data. Clicking this button invokes an expression rule which calls an integration to retrieve the latest data to return to the interface. The data in the external system changes based on actions taken by users that also use the SAIL form. Users know when they need to click the refresh button to see the newest data.
When the form is opened (it opens from a workflow task), the data is displayed. When the refresh button is clicked, the data is updated and the new data is displayed. So far, so good.
However, when the button is clicked a second time while the task remains open, the data is not refreshed and the interface shows the old data. When clicked a third time, same result (no refresh). Fourth, same result. If I close the task, re-open it, and click the button, the data once again is refreshed.... but only once. Further clicks do not refresh the data.
Any thoughts on why the button will only refresh the data once and subsequent clicks do nothing?
Here's kinda what the SAIL looks like for the button.
a!buttonArrayLayout( buttons: { a!buttonWidget( label: "Resync Data", submit: false, saveInto: { a!save( target: local!refreshResult, value: rule!PE_RefreshData( identifier: ri!dataIdentifier, firstArray: ri!array1 secondArray: ri!array2 ) ), a!save( target: ri!array1 value: local!refreshResult.dataArray1 ), a!save( target: ri!array2, value: local!refreshResult.dataArray2 ) } ) } )
Discussion posts and replies are publicly visible
Do you use a local variable inside that expression? If yes, wrap it into a a!refreshVariable call, configured to refresh always.
Appian tries to be smart and caches the data if the rule input values do not change.
I think the answer is yes. I have the local!refreshResult local variable that is only set by the call this button makes to the expression rule which refreshes the data.
I can try using a!refreshVariable and see what happens. My other solution (using the term more loosely than I care to) is to use two buttons, idendically configured, and alternately show/hide them. But, I don't really like doing this.
Yeah, and the button is not the problem ...
Ok, I wrapped the local var in the expression with refreshVariable using refreshOnVarChange (I did not wanting it to refresh every user interaction since it calls a web service)... I passed in a dummy value that I constantly change (x = x+1) and that works!
Thanks, Stefan.
RefreshAlways is the better option. This expression is only evaluated when that button is pressed. So is the call. This x+1 thing might only confuse the next developer touching this.
The next developer will be future me 3 months or so from now.... and I will definitely forget.
The help text for refreshAlways is scary.... but I don't yet understand all the nuances of Appian.
Maybe this helps
docs.appian.com/.../SAIL_Performance.html
Changed it to use refreshAlways. Thanks, again.