Check the write to Data Store after submit a interface

Hi All,

I have an interface where I use the function a!writeToDataStoreEntity when I click on the submit button.

In the function a!writeToDataStoreEntity, I declare a variable where save the value for the  onSuccess or onError . If this variable is onError, I don't want to submit the interface and advice the user about the error. Is there a way to make this?

This is an example of my case

a!formLayout(
firstColumnContents: {
allMyfields
},
buttons: {
a!buttonLayout(
primaryButtons: {
a!buttonWidgetSubmit(
label: "Start",
style: "PRIMARY",
value: "start",
saveInto: {
a!writeToDataStoreEntity(
dataStoreEntity: cons!myDataStore,
valueToStore: local!myCDT,
onSuccess: {
a!save(
local!resultWriteToDB,
"Data Inserted"
),
a!save(
ri!newBBSID,
fv!storedValues.ID
)
},
onError: {
a!save(
local!resultWriteToDB,
"Data not Inserted"
)

}
)

},
validate:true,
validationGroup: "checkSave"
)
}
),

},
validationGroup: "checkSave",
validations: {
a!validationMessage(
message:if(local!resultWriteToDB="Data Inserted","saved",""),
validateAfter:"SUBMIT"
)
}
)

 

 

Thanks in advance.

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer
    the only way which i feel is (in case if you want to use writeToDataStoreEntity Function in Interface),

    Generally you will be having a process model where you might have configured this form so, in process you can check the response inside Gateway, if it's an error, then revert it back to the same Interface again, and assign the pv! into ac! so that your input data will be maintained, in order to avoid re-entering the same again
Reply
  • 0
    Certified Lead Developer
    the only way which i feel is (in case if you want to use writeToDataStoreEntity Function in Interface),

    Generally you will be having a process model where you might have configured this form so, in process you can check the response inside Gateway, if it's an error, then revert it back to the same Interface again, and assign the pv! into ac! so that your input data will be maintained, in order to avoid re-entering the same again
Children
No Data