Shelby Owens
12/11/2024, 7:58 PMCeligo AI
12/11/2024, 7:58 PMAI generated answer (using internal Slack threads):The error message 'You have entered an Invalid Field Value 44127 for the following field: item' typically occurs when you're trying to set a value for a field that doesn't accept that value. In your case, it seems like you're trying to replace an item with an item group in an afterSubmit user event script. From the conversations, it seems like the order of setting fields matters when you're working in dynamic mode. You should set the fields in the same order you would in the UI. Also, make sure you've added the Customer and correct subsidiary first before setting the item field. Another point to consider is the type of the item you're trying to set. If you're working with item groups, be aware that the ”end of group” item (the one that lacks item number) often causes errors in script since developers are unaware of all item types. You might want to exclude it in your script. If you're still facing the issue, you might want to try disabling customizations related to sales orders in your account and see if the issue persists. Here's a sample code snippet from the conversations that might help you:
code
exports.afterSubmit = function(context) {
log.debug("afterSubmit", context);
if (context.newRecord.type !== "workorder") {
return;
}
var workorder = record.load({
type: "workorder",
id: context.newRecord.id
});
var wolineCount = workorder.getLineCount({ sublistId: "item" });
for (var n = 0; n < wolineCount; n++) {
workorder.setSublistValue({
sublistId: "item",
fieldId: "itemsource",
value: "PURCHASE_ORDER",
line: n
});
}
workorder.save();
};
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
12/11/2024, 7:58 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.845717728
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.84312892
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.842527509
Celigo AI
12/11/2024, 7:58 PM