Reputation: 21
I'm using servicenow rest-api to update sys_user table entry. I have a column constraint on Home Phone field, it is mandatory. But when send a request for update which makes Home Phone empty, servicenow accepts this request and updates a user and returns 200 OK response. I also tried to use Business rules to add this validation and throw an exception in script, but service now ignores it.
I want service now to return an error in response in such cases. Is it possible?
Upvotes: 0
Views: 938
Reputation: 1
Make the field coalesce in field mapping . And also set it choice action of the field to create
Upvotes: 0
Reputation: 213
I would suggest using an import set and the import API instead of the table API. By using an import set you can easily control imports via several methods:
// if home phone is not null, undefined, Nan, empty string (""), 0 or false this evalutes to true.
if (source.home_phone) {
error = false;
} else{
error_message = "Home Phone is a required field";
error = true;"
}
Upvotes: 0