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.

Reply
  • 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.

Children