I know about a!writetodatastore smart service function, is it possible that without navigating away from interface we are able to save the data in database using that function or is there some other way around.
Discussion posts and replies are publicly visible
Yes. You can trigger the a!writetodatastore() within an saveInto on a user interface input component. The associated documentation for this function is pretty clear.
Can you tell us more about your use case?
As Stewart mentioned, the a!writeToDataStoreEntity()* function writes to the DB upon the execution of any save action, so it might be helpful for you to describe what you want to accomplish, what you've tried already, and what you're having issues with.
Thanks Stewart Burchell that's working good.
The form had two buttons, Save for Later and Submit. On Save For Later, user didn't want to navigate away from UI. The form is divided into multiple parts for being a huge form. Every part has "Save for Later" which we wanted to save data in DB without navigating away.
To note, a trick you can use when you need to navigate away temporarily, such as uploading a document, saving data (with the Write to Datastore service), you can submit the form and chain through these other services, chain back to the form and it will appear to the user that they never left. With something such as wizard type interfaces you can pass a reference back in as to where the user was viewing and re-load that section on return.
Otherwise, the a!writeToDataStoreEntity() services works well when you can apply it within a save action.
Chris said:To note, a trick you can use when you need to navigate away temporarily, such as uploading a document, saving data (with the Write to Datastore service), you can submit the form and chain through these other services, chain back to the form and it will appear to the user that they never left.
This is what I usually advise too - it means the data will be safely cached within the process instance, without having to write it to the DB early (sometimes before we're truly ready to). It's probably the single most straightforward solution, as it requires very little modification to a form-and-process that was properly designed from the start.