I want the data to get updated in the interface in a site soon after a database operation without refreshing the page. I would like to get suggestions regarding how to implement the same.
Discussion posts and replies are publicly visible
I think your best bet is to use the a!refreshVariable() function inside a!localVariables():
https://docs.appian.com/suite/help/latest/fnc_evaluation_a_refreshvariable.html
This function can refresh the interface on an interval to show changes after a database operation. There are also a few interface patterns that describe how to do this: https://docs.appian.com/suite/help/latest/recipe-refresh-until-asynchronous-action-completes.html
Hi,
I did try using refreshVariable, but it is taking about 30 seconds to change. Is there any other way which we can use so that the changes reflect immediately after the database save?
What method of database save are you referring to? Is it a process model with a Write to Data Store node, or an on-form database save, or something else?
It is a process model with a Write to Data Store Node.
Is the database update initiated by the user on the form or is it a completely asynchronous activity? If it's asynchronous from the interface, then using the refreshVariable is probably your only option. However, if the database update is triggered by the user on the interface, you might be able to use the a!writeToDataStoreEntity() function instead of a process model. This function lets you receive a response from the database with the data written after it completes using the onSuccess parameter. See this page for more information: https://docs.appian.com/suite/help/latest/recipe-use-the-write-to-data-store-entity-smart-service-function-on-an-interface.html
is this process 100% asynchronous, i.e. the user never leaves the record?ORdoes the user leave the record when this process is started via a related action that navigates them to a task form that they would submit.
I know it's very specific, but if it's the latter, you can try activity chaining from the first flow of the process to at least the flow that follows the write to data store entity. This would ensure that the user isn't navigated back to the record until after the write is completed.
Again this partly depends on the particulars of your implementation, but in the case where you're on a Record form and you've initiated a Related Action from there, and you're returning to the form from the Related Action but still apparently seeing old data (which I've experienced fairly often) - the answer is to maintain Process Chaining within the process model at least up until the WTDS node - otherwise when the first non-chained process flow is hit, the user will return to the form instantly and probably before the WTDS node can complete.
Good points by the other comments - I think a lot more description about what you're trying to do and how it's working now would be helpful.
As an aside: the ability to "like" individual comments here (as opposed to upvoting them as a correct answer) is sorely missed - there are all kinds of situations where I wish I could click "like" on someone's comment for some reason or other without voting for it as a solution in the context of the original post.
cc: Robert Shankin, April Schuppel
anjaliv - Use Stored Values in the to save the data into PV and return it back to the screen.