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 Reply Children
No Data