Duplicate RIITM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-01-2024 09:36 AM
Hi
I m trying to Duplicate RITM through a botton (UI action), the user is directed to the article form with the RITM fields.
i have an issue with only a field : bli_contact which is a list Collector.
All other fileds are retrieved correctly.
Below codes:
UI action in the RITM form :
var ItemId = current.cat_item.sys_id;
var RitmId = current.number;
var url = 'com.glideapp.servicecatalog_cat_item_view.do?sysparm_id=' + ItemId + '&sysparm_ritmId=' + RitmId ;
action.setRedirectURL(url);
Catalog Client script :
function getParmVal(name) {
var url = top.location.href;
var value = new URLSearchParams(url).get(name);
if (value)
return value;
else {
if (window !== null) {
var gUrl = new GlideURL();
gUrl.setFromCurrent();
value = gUrl.getParam(name);
return value;
}
}
return "";
}
function onLoad() {
//Type appropriate comment here, and begin script below
var parentRitm = getParmVal("sysparm_ritmId");
if (!parentRitm || parentRitm == 'undefined') {
return;
}
var ajaxcall = new GlideAjax("get_ritm_info_build");
ajaxcall.addParam('sysparm_name', 'getItem');
ajaxcall.addParam('sys_parmid', parentRitm);
ajaxcall.getXMLAnswer(ajaxResponse);
function ajaxResponse(response) {
var result = response;
//var parser = JSONParser();
result = JSON.parse(result);
g_form.setValue('BLI', result.BLI);
g_form.setValue('short_description', result.short_desc);
g_form.setValue('code_projet', result.code);
g_form.setValue('bli_contact', result.contact);
g_form.setValue('description', result.desc);
//g_form.setValue('grs_vs_content_AddCommentToRitm', parentRitm);
}
}
Script include :
var get_ritm_info_build = Class.create();
get_ritm_info_build.prototype = Object.extendsObject(AbstractAjaxProcessor, {
ajaxFunction_getItem: function() {
var result = {};
var gr = new GlideRecord('sc_req_item');
gr.addQuery('number', this.getParameter('sys_parmid'));
gr.query();
if (gr.next()) {
result['BLI'] = gr.variables.BLI + "";
result['short_desc'] = gr.variables.short_description + "";
result['code'] = gr.variables.code_projet + "";
//result['contact'] = gr.variables.bli_contact)+ ""; => not working (bli_contact is List Collector variable)
result['desc'] = gr.variables.description + "";
}
gs.log('no : ' + JSON.stringify(result));
return JSON.stringify(result);
},
type: 'get_ritm_info_build'
});
Any idea please to retrieve the fied : bli_contact
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2024 04:49 AM
Hi Ankur,
it's a requirement requested by the customer, a user is sometimes led to make the request twice.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-02-2024 04:54 AM
Hi @Nawal
This is not the right process. The best way to ask user to create a new request.
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
01-03-2024 01:17 AM
Hi @Nawal
You may not be agree with me, but we are right person who can guide customer what is good and what is bad. I can understand it is customer requirement , but you need to do analysis why it is not a good practice and share the impact analysis with stakeholder.
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
01-03-2024 01:12 AM
Hi Ankur,
it's a requirement requested by the customer, a user is sometimes led to make the request twice.