submit form based on integration results called on submit button click

Hi,

I have a requirement to call an integration on submit button click. Based on the response from integration if error occurred i need to hold the form from being submitted or if its success i need to submit the form but should inform the user about the success through the success message. Any suggestions or design guidance would help.

local!errorMessage,

a!sectionLayout(
label: "Segment Action",
labelSize: "SMALL",
labelColor: cons!CORE_BRANDING_LABEL_COLOR,
contents: {

a!columnsLayout(...),

a!columnsLayout(...),

a!buttonArrayLayout(
buttons: {
a!buttonWidget(
label: "Save",
submit: true,
saveInto: {

rule!PM_AutoUpdatePRNSegment(....
onSuccess: {
a!save(
local!successMessage,
fv!result.body.message
)
},
onError: {
a!save(
local!errorMessage,
fv!result.body.message
)
}

style: "PRIMARY",
disabled: local!disablerule,
showWhen: local!initialAction,
validate: true(),
validationGroup: ri!index
)
},
align: "END"
)
},
validations: if(isnull(local!errorMessage),{},local!errorMessage),
isCollapsible: true,
divider: "BELOW"
)

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    He beat me to it.  If you loop in a quick enough chain back to exactly the same form with exactly the same variables, then provided there's no scrolling the user shouldn't be aware that you ever looped out and came back.

    Conversely, some other options to consider.  One would be to run the check when you press the button the first time, then change the button to show a confirmation, then click button again to submit.  You could also put a screen between that either SAYS the integration went smoothly or didn't, and it has a submit.  Now either it moves on / ends, or user winds up back on the same form.  You could have main section of the form wrapped in a container with showWhen, so you either see form or confirm/error message.  It looks like you navigated but you didn't.  Then submit button only submits when confirm is true.  If error is true, it toggles the showWhen to display the main form again.

    The key is to find a pleasing way of informing the user WHY they can't submit if they get to the situation where they can't.  Otherwise, the button just feels broken.

  • Hi Dave,

    Thanks for your Response!

    1. You are right in the first solution using Activity chaining the form will reopens and scrolls to top whereas my submit button is in the middle under a section layout which is not recommended as user gets to know.

    2. I am just trying to understand your second solution, but my concern is "What if the form gets reloaded, in case of success integration call my data was modified in DB wherein the form didn't submit and updated my reference CDT model in process model for partially saving the data". Actually, i have many sections with submit button which calls respective integration.

    My question is that when i display the messages, In case of error message i can provide button and show the interface back to the user and for reselecting the action. Whereas in case of success message integration called on submit clicked to modify data and displayed the success message with confirm button. But if user doesn't click on the confirm button or in case of form reload that section related modified data is not stored in the process model. How to handle this instance is there a possible way that we can set auto submit after showing the confirmation message after a specific interval of time or update my CDT of process model when integration is success. Suggest a way or a possible SAIL code example.

  • 0
    Certified Lead Developer
    in reply to Sameer Ul Haq

    For a confirmation screen, especially if you go the route of putting confirmation on a separate user input node in the PM, then you just configure a timeout that follows the same path submit would.  In the case of "confirm" you'd probably just route submit or timeout flows to the Terminate node at the end.

    If you chain from one form to the other, then you just make sure the results of the integration were already saved to the PM between the 2 nodes.

  • Hi Dave,

    Actually, requirement is to display the messages in the same form, the only issue i am facing is i need to save the data into my CDT present in the process model since it was a success and data got saved in my private DB as part of integration call. For that to happen i need to submit the form on integration success which is called on submit click which is i am seeing not possible because button would have already submitted the form before integration call. Hence suggest me a way i can update my CDT which is in process model without submitting the form and coming out of task in process model and using chaining i update CDT and come back to the same task so that user gets an effect that it just saved.

  • Suggest a way that i can update the current instance of PM'S CDT PV from interface without submitting the form inshort.

  • we have used activity chaning which submits the form and reopens the task with the updated cdt data and user feels like he is in the same form.

  • Ido have the similar requirement ,  where if the integration throws an error code then validation should be displayed on same form and then user needs to corrects  the field.

    in this process model ,   UIT is working on site ,after integrations fails in process model it is going back to UIT but on the site , nothing is being  displayed ,only at backend in PM ,it is waiting at UIT again .

    Can you some please help

  • 0
    Certified Lead Developer
    in reply to Tabassum

    It seems like the chain is broken.

  • Yes and you need to capture back the integration response in interface and show to user at the top of the form when error occurs checking a flag value.

Reply Children
No Data