- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2018 03:36 AM
Hi Guys,
I have written a List banner buttons (approve/reject) to show up on related list based on related list record status.
I have written as (current.state==13) for showing up button when current record is approved and (current.state==5) when current records is rejected.
But when related list has combination of both approved and rejected records, the related list should contain both approve and reject buttons.
Please help me how to keep the COND statement for this scenario in list banner button.
Appreciate your help,
Naveen B
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2018 02:43 AM
I do get it to work with passing the sys_id to the script include by using current.getUniqueValue()
Condition in UI Action
new testUtils().testFunction(current.getUniqueValue());
My Script Include
var testUtils = Class.create();
testUtils.prototype = {
initialize: function() {
},
testFunction: function(sysid) {
gs.log('TEST sys_id: ' + sysid);
var agg = new GlideAggregate('incident');
agg.addQuery('parent', sysid);
agg.addAggregate('COUNT');
agg.query();
var answer = 'false';
var count = '';
if (agg.next()) {
count = agg.getAggregate('COUNT');
if (count > 0)
answer = 'true';
else
answer = 'false';
}
gs.log('TEST count: ' + count);
gs.log('TEST answer: ' + answer);
return answer;
},
type: 'testUtils'
};
My button is being displayed/hidden depending on if there are any child incidents connected to an incident (using parent field)
Remember to check the checkbox Client Callable on the Script Include.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2018 02:43 AM
I do get it to work with passing the sys_id to the script include by using current.getUniqueValue()
Condition in UI Action
new testUtils().testFunction(current.getUniqueValue());
My Script Include
var testUtils = Class.create();
testUtils.prototype = {
initialize: function() {
},
testFunction: function(sysid) {
gs.log('TEST sys_id: ' + sysid);
var agg = new GlideAggregate('incident');
agg.addQuery('parent', sysid);
agg.addAggregate('COUNT');
agg.query();
var answer = 'false';
var count = '';
if (agg.next()) {
count = agg.getAggregate('COUNT');
if (count > 0)
answer = 'true';
else
answer = 'false';
}
gs.log('TEST count: ' + count);
gs.log('TEST answer: ' + answer);
return answer;
},
type: 'testUtils'
};
My button is being displayed/hidden depending on if there are any child incidents connected to an incident (using parent field)
Remember to check the checkbox Client Callable on the Script Include.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2018 02:44 AM
Isn't it working... current.state == '13' || current.state == '5'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2018 02:46 AM
But current will refer to the current object and not the objects in the related list?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2018 11:11 PM
Yeah I was passing current.sys_id intially
But it worked only when passing Parent.sys_id
and it is showing the buttons based on requirement.
Thank you for the help bro 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2018 12:58 AM
Could you mark the thread with a correct answer so this thread doesn't show up as unsolved?