VMware Cloud Community
CalebAsred
Contributor
Contributor

Is the RITM ticket sent in the payload to vRA/vRO upon submit?

We'd like to be able to post workflow status updates to the RITM. Assuming that the RITM ticket number is in the payload sent to vRO, does anyone know if and how to capture the RITM ticket number?

Reply
0 Kudos
4 Replies
CalsoftTechie
Enthusiast
Enthusiast

CalebAsred​ I didn't get your query. If you are asking how to capture RITM ticket number and send it to vRA/vRO platform then why you need to send RITM number to vRA/vRO platform? Any specific requirement?

Request data should be sent to vRA in requestTemplate format only.

Reply
0 Kudos
CalebAsred
Contributor
Contributor

Sure thing. See the below example of a Take Snapshot request. . . I'd like to see if the RTIM number is in the payload that  the vRA ITSM plugin sends to vRA/vRO so that my vRO workflow knows what RITM ticket to post updates to.

We need to be able to track actions against a CI. So when a user submits a Take Snapshot request via the vRA ITSM plugin, the first thing our vRO workflow does is update the RITM ticket that it's acknowledged the request and is executing the action. Once the snapshot has been taken a success note is added to the history of the RITM which triggers and update email to the requester. After that a scheduled snapshot deletion workflow is scheduled and the RITM is updated again with the date that the snapshot will automatically be deleted. Once the snapshot is deleted the workflow updates the RITM history again, which notifies the requester with an update email. Finally the workflow closes the RITM and REQ as closed complete.

Reply
0 Kudos
vaibhavdane
Contributor
Contributor

HI CalebAsred​,

As far as i know we don't see any field in request template where we can map RITM number.

Do you have any field in your catalog item where we can map RITM number and send it to vRA?

Reply
0 Kudos
CalebAsred
Contributor
Contributor

Thanks for the reply. I did find the x_vmw_vmware_vreal_vra_request_id key in the RITM json, but that ID is generated AFTER the request is submitted. Unfortunately, the workflow for the catalog item is protected. I have no idea how the RITM is created.

Here's my workaround. It generates a uuid BEFORE the request is submitted. This allows me to find the RITM via vRO.

1. Created a new ritmUuid [string] input parameter in the vRO workflow. This then shows up in the related catalog item in SNOW.

2. I created a Catalog Client Script (on-load) on the catalog item in SNOW containing the following script. When the form loads a UUID is inserted into the ritmUuid field. Then sent to vRO. vRO then finds the RITM using the api calls listed below.

//On Load Script "Generate ritmUuID"

function onLoad() {

//g_form.addInfoMessage('inside');

   //Type appropriate comment here, and begin script below

function uuidv4() {

  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {

var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);

return v.toString(16);

  });

}

var uuid = uuidv4();

//g_form.addInfoMessage('uuid: ' + uuid);

g_form.setValue('ritmUuid',uuid);

}

vRO Action:

if(ritmUuid){

//System.log("ritmUuid: " + ritmUuid);

//Get sc_item_option sys_id by ritmUuid

//https://deluxedev.service-now.com/api/now/table/sc_item_option?sysparm_limit=1&sysparm_query=value%3...

if (ritmUuid){

var operationUrl = '/sc_item_option?sysparm_limit=1&sysparm_query=value=' + ritmUuid;

var request = restHost.createRequest("GET",operationUrl);

request.contentType = "application/json";

var response = request.execute();

//System.log(response.contentAsString);

var obj = JSON.parse(response.contentAsString);

var sc_item_option_sys_id = obj.result[0].sys_id; //acquire sys_id of sc_item_option

//System.log("sc_item_option_sys_id: " + sc_item_option_sys_id);

}else{

throw new Error("Unable to get sc_item_option_sys_id because ritmUuid is null");

}

//Get ritmSysID by optionSysID

//https://deluxedev.service-now.com/api/now/table/sc_item_option_mtom?&sysparm_limit=1&sysparm_query=s...

if (sc_item_option_sys_id){

var operationUrl = '/sc_item_option_mtom?&sysparm_limit=1&sysparm_query=sc_item_option.sys_id=' + sc_item_option_sys_id;

var request = restHost.createRequest("GET",operationUrl);

request.contentType = "application/json";

var response = request.execute();

//System.log(response.contentAsString);

var obj = JSON.parse(response.contentAsString);

ritmSysId = obj.result[0].request_item.value; //acquire sys_id of request_item

//System.log("ritmSysId: " + ritmSysId);

}else{

throw new Error("Unable to get ritmSysId because sc_item_option_sys_id is null");

}

//Get sc_item_option sys_id by ritmUuid

//https://deluxedev.service-now.com/api/now/table/sc_req_item?&sysparm_limit=1&sys_id=8840ed2cdb1b2e08...

if (ritmSysId){

var operationUrl = '/sc_req_item?&sysparm_limit=1&sys_id=' + ritmSysId;

var request = restHost.createRequest("GET",operationUrl);

request.contentType = "application/json";

var response = request.execute();

//System.log('Raw response: ' + response.contentAsString);

var ritmDetails = JSON.parse(response.contentAsString);

//var ritmDetails = obj.result[0].number; //parse for a single value

}else{

throw new Error("Unable to get ritm details because ritmSysId is null");

}

}else{

throw new Error("ritmUuid is null");

}

return ritmDetails;

Reply
0 Kudos