Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Hi Community Team,
I have a grid in which lot number has to be entered and saved. But how to give a message that this lot number already exist if again someone is saving the lot number unknowingly.
Thanks,
Shraddha
The simplest solution would be, that your service (that is adding the data) returns a string with a message; like "Sucess", "ID already exist" etc. This result can be bound to a "Status Message" function in the mashup that will be triggered, when the "Service Invoke Completed" event is triggered from you "Data-Add" service. You have to make sure that your service never throws an exception, otherwise the "Service Invoke Completed" event is not triggered.
The other way is to use the "Notifcations" (see attached screenshot) of a service. With "[server-message]" you can return the error-message of the exception object, which you can modify if you want to.
Hi @DanZ ,
If I use the "notifications", how do I validate it with the data that has been already saved. Like how the check will be done if it's new entry or it's already there.
That has to be done on your service that will add the data. For example:
const addData = () => {
// Magic happens here
};
const isNewDataValid = () => {
// Your validation logic
};
if (isNewDataValid() === false) throw new Error('Validation failed!');
addData();
When using the failed notification on your service with [server-message] it should open a small popup with your error message in the mashup if the service throws an exception.