Skip to Content

SAP CAI Integartion with Open Connectors

Hi,

I am developing SAP Conversational AI Bot to integrate with ServiceNow Application and want to update an incident using incident number only and not sys_id.Please help

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Jan 30 at 01:41 AM

    Service now does not allow us to update the ticket without sys_id. What we did in our bot was we fetched the sysid using the table incident api provided by service now ->service-now.com/api/now/v1/table/incident?number="incidentnumber" and stored the sysid in bot memory. Then we used it to update the ticket. Hope this answers your question.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Mar 18 at 07:56 PM
    This is very close to something I am looking for. I am trying to replace a working servicenow webhook connection from Google DialogFlow with SAP CAI. Though it is only for demosntration purpose, I am somehow not able to make it work. I get API error.

    I roughly modified my REST API script on servicenow going through the JSON view from the CAI bot test but that did not work.

    Any help is much appreciated towards adjusting either the webhook JSON or REST script on servicenow to identify the intent and send the response in the required JSON format?

    (function process(/*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) {
    var writer= response.getStreamWriter();
    var hdrs = {};
    var x= request.body.data;
    var sn_hr_core_case = '';
    var priority = '';
    var state = '';
    var assigned_to = '';
    var context = '';
    var command = '';
    var message = '';
    var status = '';
    var desc = '';
    var caller = '';
    var content = '';
    var summary = '';
    var comments = '';
    data = {};
    if(x.queryResult.intents.slug== 'status_check')
    {
    //var number = (x.result.resolvedQuery).match(/\d+/g).join({});
    var numbers = x.queryResult.entities.hrc + "";
    //gs.log("number = "+number);
    var ci = new GlideRecord('sn_hr_core_case');
    ci.addQuery('number','ENDSWITH', numbers);
    ci.query();
    if(ci.next()){
    if(ci.assigned_to != '')
    assigned_to = ci.getDisplayValue('assigned_to');
    else
    assigned_to = "no one";
    message= "Case " + ci.number + " requested by " +ci.getDisplayValue('opened_for') + " is currently assigned to " + assigned_to + ". Current state of the incident is " + ci.getDisplayValue('state') + ". This incident is last updated by " + ci.sys_updated_by + " on " + ci.sys_updated_on + "." ;
    //summary={};
    context='success';
    }
    }
    var messages= "incident";
    hdrs['content-type'] = 'application/json';
    response.setStatus(200);
    response.setHeaders(hdrs);
    var response_body = {
    "fulfillmentText": message,
    "payload": {
    "google" :{
    "expectUserResponse": true,
    "richResponse": {
    "items": [
    {
    "simpleResponse": {
    "textToSpeech" : message
    }
    }
    ]
    }
    }
    }
    };
    writer.writeString(global.JSON.stringify(response_body));
    //return response_body;
    })(request, response);
    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.