YASSER
09/25/2024, 7:15 PMCeligo AI
09/25/2024, 7:15 PMAI generated answer (using internal Slack threads):To create a popup message when the invoice is in 'Pending Approval' status and in view mode, you can use a SuiteScript User Event script. This script will be triggered when the record is being viewed. Here is a sample code snippet:
javascript
/**
* @NApiVersion 2.x
* @NScriptType UserEventScript
*/
define(['N/ui/message'],
function(message) {
function beforeLoad(context) {
if (context.type !== context.UserEventType.VIEW)
return;
var record = context.newRecord;
if (record.type !== record.Type.INVOICE)
return;
var approvalStatus = record.getValue('approvalstatus');
if (approvalStatus == '2') { // 2 is the internal id for Pending Approval
var myMsg = message.create({
title: "Pending Approval",
message: "This invoice is pending approval.",
type: message.Type.WARNING
});
myMsg.show();
}
}
return {
beforeLoad: beforeLoad
};
});
This script checks if the record being viewed is an invoice and if its approval status is 'Pending Approval'. If both conditions are met, it shows a warning message.
Please note that you need to deploy this script on the Invoice record type.
******
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
09/25/2024, 7:15 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.841599464
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.838449121
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.834818482
Celigo AI
09/25/2024, 7:15 PM