- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2022 10:51 PM
Hello All,
can anyone please guide me how to count affected ci on incident form and display when form load?
Thank You.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2022 11:10 PM
Hello,
Please do the below:-
Write a display BR on incident table with the below code:-
(function executeRule(current, previous /*null when async*/) {
var rec = new GlideRecord('task_ci');
rec.addQuery('task', current.sys_id);
rec.query();
if(rec.next()){
g_scratchpad.count=rec.getRowCount();
}
})(current, previous);
Then write a onload client script with below code:-
Now if you want to show it as a message on load use below:-
function onLoad() {
//Type appropriate comment here, and begin script below
var count=g_scratchpad.count;
g_form.addInfoMessage(count);
}
Now if you want to set it on a field on load use below:-
function onLoad() {
//Type appropriate comment here, and begin script below
var count=g_scratchpad.count;
g_form.setValue('fieldname',count);
}
Please mark my answer as correct based on Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-18-2022 12:44 AM
Hello, @reshmapatil what will be the condition of the data policy? our requirement is when we add ACIs the particular field will be visible.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-18-2022 01:02 AM
Hi @Sagar_pawar ,
For now, I can only think of having one temporary field which will be updated through ACL and in Data policy we can check that field value and set our actions.
Regards,
Reshma
**Please mark my answer correct or helpful based on the impact**