Hi All,
I am facing one challenge to implement one behaviour in appian interface. My interface presents the read only data to the user and user will take action based on his findings by selecting a dropdown value. Finally user hits a "SUBMIT" button whose implemetation is as below. where we call an integration which will update the data and returns an error if an exception found. So my requirement is when user clicks "SUBMIT" button if error occured then form should not submit and close and error message should be displayed. If data updated successfully form should close. I tried below submit condition as well but it didnt work. suggest something.
a!buttonArrayLayout( buttons: { a!buttonWidget( label: "Update", saveInto: { rule!PM06_PortalApprove( tenantId: "77b50320-5f06-5740-84f4-18d4a8cda51d", identifierId: "s57", portalTransactionId: property(local!jsonData, "PortalTransactionId", null), comments: "test", onSuccess: { /* Handle successful update */ a!save(local!ErrorMessage, null) }, onError: { /* Handle HTTP error */ a!save(local!ErrorMessage, fv!error.message) } ) },submit: if(isnull(local!ErrorMessage),true(),false()), style: "PRIMARY", loadingIndicator: true, validate: true ) }, align: "END" )
Discussion posts and replies are publicly visible
Let's first understand how a submit button works on Appian. When you click on that button and all the conditions are met, then only the button will execute all the various saves. This means that by the time the integration was fired, the button was already clicked so you cannot control submitting the form if you only plan to have a single button and a single click.
What you can do instead is to let the form submit itself and call the integration in the process in a script task and use an XOR to check the result of it. If it is an error, route back the process to the same UIT with activity chaining so it looks like nothing happened and if there is no error, continue the normal flow.
Hi, one more way of doing this is instead of using submit button for the validation you can use two buttons first one is to call the integration, and the second one is to submit the form you can use the show when condition on the SUBMIT button based on the error
I suggest to implement this in the way Appian is meant to be used. And this is, put it into a process. Submit that form, do the integration call in the process and, in case of an error, loop back to the first interface showing the error message to the user.
Its like task got closed but looped back and reopened with an error. As per the requirement we wanted to conditionally submit a form based on the integration call results and show the message if error occurred to the user. Suggest any other design pattern other than looping back the task. would be appreciated.
Is their any possible way to achieve with single button and any number of clicks and submit form on only success integration call and show error in integration fails.
Looping back approach we are considering wherein lookin forward to achieve in same interface with single button .
I'm afraid these are the only possible solutions if your integration is of the type - Modifies Data.
Sameer Ul Haq said:As per the requirement we wanted to conditionally submit a form based on the integration call results and show the message if error occurred to the user.
From the user's perspective this is exactly what would happen. I'm not clear why Harshit's suggested solution is insufficient for you, as it satisfies ever requirement you've laid out in terms of the desired user experience.