Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Integration/Scripted SOAP Incident Creation/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
I have created a scripted SOAP service for creation of incident with the help of third party tools, with all mandatory validations. My API will check the validations while creating the incidents from third party tool and it won't allow to submit the record untill all validations will pass.
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
(function scriptedWebServiceOperation(request, response) {

var v1=checkMandatory(); // This function will check the all mandatory validations.
if(v1==true){
var grinc = new GlideRecord('incident');
grinc.initialize();
grinc.caller_id=request.Caller_id;
grinc.short_description=request.Short_Description;
grinc.cmdb_ci=request.CI;
grinc.insert(); // It will insert the record, with provided values.
response.Result='Incident Created';
response.Sys_Id=grinc.sys_id; // It will return the sys_id in response body.
response.Number=grinc.number; // It will return the incident number in response body.
}else{
response.Result=v1;
}
function checkMandatory() {
if (request.Caller_id) {
if (request.Short_Description) {
if (request.Description) {
if (request.CI) {
var grci = new GlideRecord('cmdb_ci'); // These are the mandatory validations while submitting the request from client.
grci.addQuery('name',request.CI);
grci.addQuery('opertaional_status','1');
if(grci.next){
return true;
}else{
return 'CI not found or may be it is not in opperational state';
}
} else {
return 'CI can not be blank';
}
} else {
return 'Description can not be empty';
}
} else {
return 'Short description can not be blank';
}
} else {
return 'Caller Id can not be blank';
}
}

})(request, response);