Show checklist template on task by default
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2023 01:55 AM
Hi everyone,
I want to automate the call of a checklist template for certain changes tasks.
I've tried this, but I have to hardcode the coosen change task.
new ChecklistUtil().createChecklistFromTemplate('69b29e611b75f5100c420e93604bcbf7', 'change_task', '1d45b3ea1bc67150530ea9f1604bcb75');
I want to make the last part dynamic:
new ChecklistUtil().createChecklistFromTemplate('69b29e611b75f5100c420e93604bcbf7', 'change_task', 'every change task with a specifc short_description');
Can anyone help me with the code for my business rule?
Thanks in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2023 03:49 AM - edited 10-26-2023 03:50 AM
Hi @Matki ,
To achieve the above scenario you have to write after insert,update business rule on change_task table condition for specific short description='your sd' and use below script
(function executeRule(current, previous) {
var checklistTemplateSysId = '69b29e611b75f5100c420e93604bcbf7';
var changeTaskTable = 'change_task';
var specificShortDescription = 'Your Specific Short Description';
var changeTaskGR = new GlideRecord(changeTaskTable);
changeTaskGR.addQuery('short_description', specificShortDescription);
changeTaskGR.query();
while (changeTaskGR.next()) {
var checklistUtil = new ChecklistUtil();
checklistUtil.createChecklistFromTemplate(checklistTemplateSysId, changeTaskTable, changeTaskGR.sys_id);
}
})(current, previous);
Please mark it as helpful and solution proposed if it serves your purpose.
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2023 06:01 AM
Hey Anand,
thanks for your help!
Unfortunately it does not work. I 've modified the code a little bit but without success...
Greetings