Skip to main content
September 23, 2021
Question

How to validate form based on integration result

  • September 23, 2021
  • 5 replies
  • 0 views

we have an interface where we are call an integration (passing data provided by the user in that interface) on submit button.

If integration got failed, then we need to display a validation message on one of the text field in the interface. else if it got succeeded then form has to submit.

    5 replies

    stefanhelzle0001
    Brainy
    September 23, 2021

    You have multiple options. The straight forward one is to add another user input task to your process model and add a XOR in the path checking the result of the integration. If the integration fails, go to the new task. Make sure to enable chaining on all connectors between the first task and the new one. The new added task can show that error message to the user.

    Depending on your needs you can allow the user to modify the data and retry.

    September 24, 2021

    I am looking to validate with in the same interface instead of moving to another one

    Participating Frequently
    September 24, 2021

    Hi Suresh,

    If you want to call and validate the service response at Submit button and you don't want to proceed to next interface in case of failure, i think we need to put validation rules so that when service has failed it should not allow form to be submitted.

    You could try to implement below logic, to stop form being submitted in case of service failure:

    a!localVariables(
    local!success: {},
    {
    a!sectionLayout(
    contents: {
    a!textField(
    label: "Service Input",
    value: ri!integrationInput,
    saveInto: ri!integrationInput,
    validations: if(
    local!success,
    {},
    "Service Failure Message"
    )
    ),

    },

    ),
    a!buttonArrayLayout(
    buttons: {a!buttonWidget(
    label: "Submit",
    style: "PRIMARY",
    saveInto: {
    a!save(
    local!success,
    rule!integrationCall(
    ri!integrationInput
    ).success
    )
    },
    submit: true,
    validate: true
    )}
    )}