YASSER
12/12/2024, 9:45 PMCeligo AI
12/12/2024, 9:45 PMAI generated answer (using internal Slack threads):To show item manufacturing date and expiry date in inventory detail in the item record, you can create custom fields for these dates. However, the inventory detail screen is a subrecord and is not directly scriptable via client script. To make the "Expiration Date" mandatory for some Lot/Serial Items based on a field/flag on the Item record, you can use a saveRecord entry point script to review all inventory detail subrecords of all lines and validate the expiration dates accordingly. If you find one missing, you can show an alert message and return false from the saveRecord function. For the manufacturing date, you can add a field on the inventory number, but it must be filled after you have received the item. Here is a sample script for the saveRecord entry point:
javascript
function saveRecord(context) {
var currentRecord = context.currentRecord;
var lineCount = currentRecord.getLineCount({sublistId: 'inventory'});
for (var i = 0; i < lineCount; i++) {
var expirationDate = currentRecord.getSublistValue({
sublistId: 'inventory',
fieldId: 'expirationdate', // replace with your custom field id
line: i
});
if (!expirationDate) {
alert('Expiration Date is mandatory for this item.');
return false;
}
}
return true;
}
Please replace 'expirationdate' with your custom field id. This script will check each line of the inventory sublist for an expiration date, and if it finds a line without one, it will show an alert and prevent the record from being saved.
******
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/12/2024, 9:46 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.829014957
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.821558058
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.818018913
Celigo AI
12/12/2024, 9:46 PM