- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2023 05:32 AM - edited 11-10-2023 05:33 AM
Hello,
I would like to receive some help. I have tried to solve this functionality request, but haven't succeeded, so therefore I am reaching out to this amazing community.
I would like to change our current UI action, which creates a change request from a RITM and transfers some of the RITM fields into the Change fields. The change should now include that it also opens the new change in a new window. Currently the ritm window is being refreshed, as per SN default. However, my colleagues would like to keep having the RITM open while opening the change request.
So how can I add that functionality of opening the change in a new window tab?
I have tried to include it in the script as per other community post solutions and check the client script, but haven't suceeded yet. Errors keep popping up when trying to include both server and client side script in the same ui action.
Let me know if further info is needed.
Thanks!
Solved! Go to Solution.
- Labels:
-
Change Management
-
Request Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2023 03:46 PM
Hi @Lkr, In UI actions you can pass value from client to server & not the other way around. To open a URL in new window you can use below code(you might have to tweak as per your requirement though):
1. Create a Client callable script include
var ChangePopupTest = Class.create();
ChangePopupTest.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getNewWindow: function() {
var parentID = this.getParameter('sysparm_url');
//below code is from the OOTB Create Change UI action
var url = new GlideURL("change_request.do");
url.set("sys_id", "-1");
url.set("sysparm_query", "^parent=" + parentID);
var finalStr = url.toString();
return finalStr;
},
type: 'ChangePopupTest'
});
2. In the original Create Change UI action, select 'Client' checkbox, add call below function in the onClick field & add below code in the script.
function fetchURL() {
var ga = new GlideAjax('ChangePopupTest');
ga.addParam('sysparm_name', 'getNewWindow');
ga.addParam('sysparm_url', g_form.getUniqueValue());
ga.getXML(showPopup);
function showPopup(response) {
var newURL = response.responseXML.documentElement.getAttribute("answer");
g_navigation.openPopup(newURL);
}
}
Please mark helpful and correct if it resolved your issue.
Johnny
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2023 05:49 AM
Hi @Samaksh Wani
Thank you, have tried without luck. Could it be because i use wrong URL in ('you URL',"_blank');
What could an example be if the url should be the newly created change_request.do?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2023 06:31 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2023 06:57 AM
I doubt it should be full Url like : instance.servcie-now.com/tablename.do
Like we we use in integration.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2023 12:40 PM
@Lkr"I am in a similar situation as you. Have you managed to achieve your goal?"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2023 03:46 PM
Hi @Lkr, In UI actions you can pass value from client to server & not the other way around. To open a URL in new window you can use below code(you might have to tweak as per your requirement though):
1. Create a Client callable script include
var ChangePopupTest = Class.create();
ChangePopupTest.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getNewWindow: function() {
var parentID = this.getParameter('sysparm_url');
//below code is from the OOTB Create Change UI action
var url = new GlideURL("change_request.do");
url.set("sys_id", "-1");
url.set("sysparm_query", "^parent=" + parentID);
var finalStr = url.toString();
return finalStr;
},
type: 'ChangePopupTest'
});
2. In the original Create Change UI action, select 'Client' checkbox, add call below function in the onClick field & add below code in the script.
function fetchURL() {
var ga = new GlideAjax('ChangePopupTest');
ga.addParam('sysparm_name', 'getNewWindow');
ga.addParam('sysparm_url', g_form.getUniqueValue());
ga.getXML(showPopup);
function showPopup(response) {
var newURL = response.responseXML.documentElement.getAttribute("answer");
g_navigation.openPopup(newURL);
}
}
Please mark helpful and correct if it resolved your issue.
Johnny
Please mark this response as correct or helpful if it assisted you with your question.