ChaitanyaKaranam / servicenow-rest-api

Node.js Wrapper library for ServiceNow REST API.
https://www.npmjs.com/package/servicenow-rest-api
MIT License
18 stars 21 forks source link

Get RITM variables #17

Open konijn opened 3 years ago

konijn commented 3 years ago

Greetings,

love the library! I do manage to authenticate and get details for a RITM, but in the webinterface I see a section called 'variables' and I do not know how to retrieve them.

I read on one forum that I have to query sc_item_option_mtom with the sys_id of the RITM, but nothing comes back.

Hoping you can at worst tell me how to get this done with this library or at best add a feature to get it for me ;)

fdemberla commented 3 years ago

Hello,

I have a workaround for that, the request should look something like this:

var scItemFields = ['sc_item_option', 'sc_item_option.item_option_new.name', 'sc_item_option.value', 'request_item.sys_id'] var scItemFilters = [request_item=${request_item.sys_id}]

That will return a list of objects, each object is a "variable" with the "variable name" and the value.

In my solution i search for tasks opened today, it uses the request_item.sys_id to make one search at a time (depends on the amount of tasks found).

ChaitanyaKaranam commented 3 years ago

Hello,

I have a workaround for that, the request should look something like this:

var scItemFields = ['sc_item_option', 'sc_item_option.item_option_new.name', 'sc_item_option.value', 'request_item.sys_id'] var scItemFilters = [request_item=${request_item.sys_id}]

That will return a list of objects, each object is a "variable" with the "variable name" and the value.

In my solution i search for tasks opened today, it uses the request_item.sys_id to make one search at a time (depends on the amount of tasks found).

@konijn This is how I would do it. I will check if there is any other alternative.