01-08-2021 01:57 PM
Currently in Script steps we pull data (via a jdbc connection to a datasource) from a ticket system using the DB Read / DB Get steps , make them variables , then present them in the Finesse Desktop Call Variable Layout.
Currently gather several pieces of data from 3 tables in the database. Initially we authenticate the caller by prompting for their ID & PIN numbers in the DB Read / Get , then returns the ID if valid.
If valid ID, Next is DB Read / Get steps of the other information about that caller from that DB in 3 steps to pull for the other variables
We are moving to a different type ticketing system that is web / cloud based and no jdbc / data source ability.
We want to gather the same data , make them variables, and have them presented in the Desktop Call Variable Layout from the new system .
Vendor from new service (Service Now) provided a url , userid, & password. They stated they are trying to provide a single response with all the data I am currently pulling. (they thought this might make it simpler for coding on my end). I have no idea if this makes it simpler or not.
I do not have any experience with REST API, but am told this is the avenue I should try with UCCX script to Service Now system. Not sure if the single response with multiple data (variables) is the efficient / best method or it needs to be different.
Been trying to read / understand the Editor Step Reference Guide in reference to the Make REST Call . Never used this step and not sure if All fields are required
Also looking in Cisco DevNet learning to get some basic understanding of REST API. There doesn’t seem to be a example of a REST API with UCCX step editor to try and retrieve the data (as currently done with the sql DB)
I assume there are multiple steps involved to be able to contact that system and pull out the information to then set the variables for the Set Enterprise Info step that puts the information in the Finesse Desktop Call Variable Layout.
If anyone has any pointers or can provide any sample script or configuration of steps tips , it would be greatly appreciated.
Solved! Go to Solution.
01-12-2021 02:07 AM - edited 01-13-2021 12:50 AM
Hey Ileweyeiss
For integration with Servicenow you will get a JSON or XML response.
Here is how you get an json response from Servicenow using the "Make REST Call"
Url : Is the url ServiceNow provide.
TimeOut : Milliesekunds before the call is timeOut
UserId : Provided By ServiceNow
PAssword : Provided By ServiceNow
Content type : What you will have back
Method : Post / Get
Parameters : Url parameters
Body : Request Body (if any) (Type String)
Response : Data you will recieve from you request (Type String)
Status Code : HTTP code (Type String)
Status Detail :(Type String)
Lets asume you a getting JSON back (If you put in "application/json" in content type)
After you have made the "Make Call Step" use the "Create Json document" like this:
jsonDoc : Type Document in ccx
After you have made the document, you can then use the dot notation to get data from the json object using the "Get JSON Document Data" step :
Response from ServiceNow from the website:
{ "result": [ { "user.name": "Fred Johnson", "user.sys_id": "f5a3716d0f6002003a2d47bce1050ed4", "role.name": "support", "user.department": { "display_value": "Accounting", "link": "https://<instance>.service-now.com/api/now/table/cmn_department/5b3b13530f58c2003a2d47bce1050e96" }, "role": { "display_value": "support", "link": "https://<instance>.service-now.com/api/now/table/sys_user_role/3d43716d0f6002003a2d47bce1050e0d" }, "user": { "display_value": "Fred Johnson", "link": "https://<instance>.service-now.com/api/now/table/sys_user/f5a3716d0f6002003a2d47bce1050ed4" } }, { "user.name": "Fred Johnson", "user.sys_id": "f5a3716d0f6002003a2d47bce1050ed4", "role.name": "asset_mgmt", "user.department": { "display_value": "Accounting", "link": "https://<instance>.service-now.com/api/now/table/cmn_department/5b3b13530f58c2003a2d47bce1050e96" }, "role": { "display_value": "asset_mgmt", "link": "https://<instance>.service-now.com/api/now/table/sys_user_role/ac73b52d0f6002003a2d47bce1050eec" }, "user": { "display_value": "Fred Johnson", "link": "https://<instance>.service-now.com/api/now/table/sys_user/f5a3716d0f6002003a2d47bce1050ed4" } } ] }
CCX step :
This will set the variable "link" in you script to highlightet in the JSON doc
The dot notation
result[0].user.display_value
will give you "Fred Johnson"
You can use http://jsonpath.com/ to build your dot notation
Hope this helps.
Best regards
Thomas
01-12-2021 02:07 AM - edited 01-13-2021 12:50 AM
Hey Ileweyeiss
For integration with Servicenow you will get a JSON or XML response.
Here is how you get an json response from Servicenow using the "Make REST Call"
Url : Is the url ServiceNow provide.
TimeOut : Milliesekunds before the call is timeOut
UserId : Provided By ServiceNow
PAssword : Provided By ServiceNow
Content type : What you will have back
Method : Post / Get
Parameters : Url parameters
Body : Request Body (if any) (Type String)
Response : Data you will recieve from you request (Type String)
Status Code : HTTP code (Type String)
Status Detail :(Type String)
Lets asume you a getting JSON back (If you put in "application/json" in content type)
After you have made the "Make Call Step" use the "Create Json document" like this:
jsonDoc : Type Document in ccx
After you have made the document, you can then use the dot notation to get data from the json object using the "Get JSON Document Data" step :
Response from ServiceNow from the website:
{ "result": [ { "user.name": "Fred Johnson", "user.sys_id": "f5a3716d0f6002003a2d47bce1050ed4", "role.name": "support", "user.department": { "display_value": "Accounting", "link": "https://<instance>.service-now.com/api/now/table/cmn_department/5b3b13530f58c2003a2d47bce1050e96" }, "role": { "display_value": "support", "link": "https://<instance>.service-now.com/api/now/table/sys_user_role/3d43716d0f6002003a2d47bce1050e0d" }, "user": { "display_value": "Fred Johnson", "link": "https://<instance>.service-now.com/api/now/table/sys_user/f5a3716d0f6002003a2d47bce1050ed4" } }, { "user.name": "Fred Johnson", "user.sys_id": "f5a3716d0f6002003a2d47bce1050ed4", "role.name": "asset_mgmt", "user.department": { "display_value": "Accounting", "link": "https://<instance>.service-now.com/api/now/table/cmn_department/5b3b13530f58c2003a2d47bce1050e96" }, "role": { "display_value": "asset_mgmt", "link": "https://<instance>.service-now.com/api/now/table/sys_user_role/ac73b52d0f6002003a2d47bce1050eec" }, "user": { "display_value": "Fred Johnson", "link": "https://<instance>.service-now.com/api/now/table/sys_user/f5a3716d0f6002003a2d47bce1050ed4" } } ] }
CCX step :
This will set the variable "link" in you script to highlightet in the JSON doc
The dot notation
result[0].user.display_value
will give you "Fred Johnson"
You can use http://jsonpath.com/ to build your dot notation
Hope this helps.
Best regards
Thomas
01-13-2021 06:09 AM
Hey Thomas G.J.
Thank you for taking the time to provide all this information. It is greatly appreciated ! I am a complete novice in the area of REST API but will do my best to work with what you provided.
As a general question, the Create JSON Doc step, is that a doc that is saved to the server that I will need use a step to later remove so as to not be storing them after the subsequent Set Enterprise Info steps to create the variables. (each call in to the contact center will be doing the REST API call). (I assume the doc will be small in size, but also assume if saved to server, it would seem at some point I would need to clean out / remove).
I will work on this and (hoping no really stupid questions arise) get it to work and will follow up with a 'accept as solution'.
01-15-2021 12:14 AM
The Create Json Doc is only making a document object and is not saving it anywhere - so no need to clean up.
You can with no problem use this for every customer.
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: