- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-21-2020 12:35 AM
Hi All,
Can anyone provide step by step information, how to create as Incident from one instance in other instance through UI action.
Please help.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-21-2020 12:46 AM
Hi Navya,
Step1:Create a POST Rest Message which will create an incident from instance A on instance B.
Step2: Create an UI action call the REST message via this UI action script. for simplicity we have a option for each rest message "view Script Usage". You will get the code to call the REST message.Paste into the UI action.
For step 1, I have added an attachment.
For Step2, Create an UI action that will call the script message in the UI action script.
Thanks
Sudhanshu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2020 03:50 AM
The sysid of the user is different. In this case how can we get the value of the opened by of RITM to the Caller field in Incident.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2020 05:51 AM
Hi Navyaa,
This is the scenario where Table API fails, because the instances are not synchronized in terms of user sys_id. I make a POST REST API call to the OOB Table API of other instance I have to pass on sys_id which will be same or(synced)& assosciated with same user as well on target instance.
So these kinds of scenarios have two solutions:
Keep your instances sync,which is not possible.
Second solution is define your own Web Services rather then making POST REST call to OOB API, where you have full fledge ways to handle inputs/outputs.
In web services you have to define the transform map. There you have the option to write onBefore transform script where you manipulate the incoming data.
Instance A: WebService X
Instance B:Send REST post message to instance A webservice X, rather then passing sys_id we will pass user_name which will be same on the two instance, I am sure:
Then write onBefore transform script:
function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
// Add your code here
var caller_id = source.user_id;
var gr = new GlideRecord("sys_user");
gr.addQuery("user_name",caller_id);
gr.query();
if(gr.next()){
source.user_id=gr.sys_id;
}
}
This script will transform the user_name with sys_id & the user_id field when mapped to caller field of the User table, you will get the caller ID.
Sorry I am writing so long but that's the whole procedure to do this.
Thanks Sudhanshu.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2020 07:59 AM
Sorry to say, but I am new to API's. Can you just elaborate please where to create.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2020 08:12 AM
I have used current.getDispalyValue() in the UI Action in Instance A and its getting updated in the Incident which is created in Instance B.
Sorry to bother, but I have one more question, how can we get the Incident number that is being created in Instance B to Instance A
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-23-2020 08:31 AM
Have you written the REST API call in the script of UI action?
If that is the case it will surely happen as it will again call the POST REST API.
Fetch from instance B via GET REST API CALL
Mark it helpful/Correct.
Thanks
Sudhanshu