ログを出力するScript Include

RestとScript
https://community.servicenow.com/community?id=community_article&sys_id=35f7d53ddb2ed3800be6a345ca961957

[作業要件]
1Rest Inbound から Script Includeよべるか -> 〇
2Script Rest からOutboundできるか ->

1
-----------------
var Logprint = Class.create();
Logprint.prototype = {
    initialize: function() {
gs.log('@@@Test');
var msg = 'テスト中だよ!';
gs.log('@@@' + msg);
    },

    type: 'Logprint'
};
-----------------
var log = new Logprint();


2.API参照
http://project.iw3.org/zip_search_x0401/
(function execute(inputs, outputs) {
    var response = JSON.parse(inputs.response);
    outputs.state = response.state;
    outputs.stateName = response.stateName;
    gs.log(outputs.state);
    gs.log(outputs.stateName);
    var log = new Logprint();
   
   })(inputs, outputs);
-------------
ここまでできた
-------------
3.script includeをoutboundすること
つまり書き込み先をさくせいすること
Firebase or Google SpreadSheet.スプレッドシートでおけ
下記にoutbound書いてある
https://docs.servicenow.com/bundle/newyork-application-development/page/integrate/outbound-rest/task/t_ScriptingWithREST.html

REST用のコードは二つある。
①script > REST message
https://docs.servicenow.com/bundle/newyork-application-development/page/integrate/outbound-rest/task/t_ScriptingWithREST.html
②script直接
https://docs.servicenow.com/bundle/newyork-application-development/page/app-store/dev_portal/API_reference/RESTMessageV2/reference/r_RecordlessRESTMessageV2Example.html

var ScriptIncludeRest = Class.create();
ScriptIncludeRest.prototype = {
    initialize: function() {
gs.log('@@@:テスト中だよ!');

try{
var r = new sn_ws.RESTMessageV2('Firebase Cloud Messaging Send','post');
var response = r.execute();
var responseBody = response.getBody();
gs.log('これはレスポンスボディ:'+ responseBody);
var httpStatus = response.getStatusCode();
}
catch(ex){
var message = ex.getMessage();
}

gs.log('@@@テスト終わりだよ');
    },

    type: 'ScriptIncludeRest'
};

Next Post Previous Post
No Comment
Add Comment
comment url