- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2025 06:45 AM
I have setup a stockroom and assigned a manager (and the manager has an email address) I have added an item into the stockroom.
Then I have setup a stock rule for the item with a Threshold = 0 and a Restock Option = stock room
So now there are 0 in stock and the stock rule should kick in.
i tried to change the next action date on the stock rule running but still not getting the sctask created . any idea how to fix this ?
Solved! Go to Solution.
- Labels:
-
Asset Management
-
Walk-Up Experience
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2025 03:45 AM
i found the solution too . to add this part that if the restocking option is set to stockroom , there will be task ticket assigned to the stockroom manager
_processStockoomStockrule: function(stockRuleGr) {
var parent = stockRuleGr.parent_stockroom;
var stockroom = stockRuleGr.stockroom;
var model = stockRuleGr.model;
var supply = this.transfer.getTotalRecordCount(stockroom, model);
var threshold = parseInt(stockRuleGr.threshold, 10);
var need = threshold - supply;
var order = 0;
var size = parseInt(stockRuleGr.order_size, 10);
if (need > 0) {
if (size <= 0) {
order = need;
} else {
while (order < need) {
order += size;
}
}
var stock = this.transfer.checkStockroomTransferAvailability(parent, model);
if (stock >= order) {
if (model.sys_class_name.toString() === this.CONS_MODEL
|| model.asset_tracking_strategy.toString() === this.TRACK_CONS) {
this.transfer.consumableTransfer(parent, stockroom, model, order);
} else {
this.transfer.assetTransfer(parent, stockroom, model, order);
}
// ✅ Set pending_delivery to true
stockRuleGr.pending_delivery = 'true';
stockRuleGr.update();
// ✅ Create a Task for Asset Manager with requested format
var task = new GlideRecord('task');
task.initialize();
task.assigned_to = stockroom.manager; // Assign to stockroom manager
task.short_description = 'Quantity threshold breached: ' + stockroom.name;
task.description = 'Stockroom: ' + stockroom.name + '\nItem: ' + model.display_name +
'\nQuantity: ' + supply + '\nThreshold: ' + threshold;
task.insert();
} else {
// ✅ If stock is unavailable, create a task for asset manager to take action
var task = new GlideRecord('task');
task.initialize();
task.assigned_to = stockroom.manager;
task.short_description = 'Quantity threshold breached: ' + stockroom.name;
task.description = 'Stockroom: ' + stockroom.name + '\nItem: ' + model.display_name +
'\nQuantity: ' + supply + '\nThreshold: ' + threshold +
'\nParent Stockroom: ' + parent.name + '\nRequired: ' + order +
'\nAvailable in Parent: ' + stock;
task.insert();
}
}
},
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-30-2025 05:24 PM
this is in the script includes . i do not see task ticket open after manually triggering by setting the state to running .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2025 01:46 AM
The script says it's creating a record on the 'task' table, not sctask what you mentioned earlier. Next to that, what plugins do you have active, because the script is looking at that.
Also, you say you set the script to 'running' but does it in fact run. You are only mentioning things you do to the script, but not the results of it. Does the script in fact run?
And the 'execute now' button is OOB only for 'maint' as I already mentioned. So if you want to use it, you need to change it to 'admin'.
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2025 02:54 AM - edited 01-31-2025 02:54 AM
@Mark Manders i did not have access to HAM and EAM plugin as i am on the PID so they should be opening a lot of task ticket but all i can see there is only 1 that was opened last night . no matter how many time i pressed on the execute now button.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2025 02:58 AM
You mentioned you had one item in the stockroom? Why are you expecting tasks to be created multiple times? You have a task, so it works.
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2025 03:08 AM - edited 01-31-2025 03:27 AM
@Mark Manders i think i found the issue is that if the restock rule is set at stockroom and not vendor i am not getting the task ticket , when i set to vendor , i am getting both the PO and task ticket