How to add list collector to the form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-17-2022 09:41 AM
Hello
Can anyone explain me, ow to add a list collector to a form
Thanks in advance
- Labels:
-
Request Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-18-2022 03:54 AM
I tried and finally came up with a solution:-
1. Created 2 fields Ritm lists and Bundle
2. Now since the bundle ID and RITM list is mapped, in another Ritm, if you try same RITM list bundle,
it will give the bundle number with green color means it exists else throw red color with new bundle ID mapped .
Done via onChange client script+script include
3. If bundle does not exits, then generated a new bundle ID with RED color showing it not exists
Client script on change of RITM list:-
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
g_form.clearValue('u_bundle');
var lists = ""+ g_form.getValue('u_ritm');
var ga = new GlideAjax("getBundle");
ga.addParam('sysparm_name','getBund');
ga.addParam('sysparam_ritmList',lists);
ga.getXML(getBund);
function getBund(response)
{
var answer = response.responseXML.documentElement.getAttribute("answer");
var sp = [];
sp = answer.split(",");
g_form.setValue('u_bundle',sp[0]);
var element = g_form.getElement('u_bundle');
element.style.backgroundColor = sp[1];
}
}
Script include
var getBundle = Class.create();
getBundle.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getBund: function(){
var bund = ""+this.getParameter("sysparam_ritmList");
var bundle="";
var array1=[];
var array2=[];
var gr = new GlideRecord("sc_req_item");
gr.addEncodedQuery('u_ritmIN'+bund);
gr.query();
if(gr.next())
{
array1 = gr.u_ritm.split(",");
array2 = bund.split(",");
var array2Sorted = array2.slice().sort();
var rs = array1.length === array2.length && array1.slice().sort().every(function(value, index) {
return value === array2Sorted[index];
});
if(rs == true)
{
bundle = gr.u_bundle+","+"green";
}
else
{
bundle = "BUN"+Math.floor((Math.random() * 1000000) + 1)+","+"red";
}
}
if(bundle == '')
{
bundle = "BUN"+Math.floor((Math.random() * 1000000) + 1)+","+"red";
}
return bundle;
}
});
If its helpful,please mark answer as correct
Anshu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-18-2022 04:39 AM
Thank you so much Anshu, for the clear explanation. It helps alot
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2022 05:50 AM
If I want to hide the RITM's which are already bundled, how can I achieve this requirement using reference qualifier. and I want to create the bundle field as number type which will be generate automatically.
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2022 09:20 AM
where you want RITM to be hidden?
list collector of RITM ?
Anshu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2022 11:30 PM
Yes, in list collector RITM. If I have selected the bundle of ritm's I don't want to display them in the list collector