How to create multiple TASKs for 1 RITM based on desired quantity entered
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2023 09:40 AM - edited 11-14-2023 10:14 AM
Hello community,
Is it possible to create multiple TASKs from 1 RITM based on the desired quantity entered in the Catalog Item form? Or perhaps have multiple RITMS>TASKs based on quantity entered?
All TASKs would need to be created at the same time.
The quantity input would be a "Select Box" variable, but of course open to any suggestions.
TYIA,
Joel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2023 10:54 AM - edited 11-14-2023 11:14 AM
The sc_req_item table has a 'quantity' field, defined as integer. A business rule defined on that table, with logic as follows can create sc_task records
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var scTask = new GlideRecord('sc_task');
for (i = 0; i < current.quantity; i++) {
scTask.initialize();
scTask.request_item = current.sys_id;
scTask.short_description = "This is task " + (i+1) + " of " + current.quantity + " for " + current.number;
// see additional sc_task fields as desired
scTask.insert();
}
})(current, previous);
It is possible to have multiple sc_task records associated with a sc_req_item record.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2024 06:51 AM
Is there a maximum number that can be generated simultaneously?
thanks