NS AdminA
03/18/2025, 4:35 PMCeligo AI
03/18/2025, 4:35 PMAI generated answer (using internal Slack threads):To create a customization that will display a banner on an expense report when an expense line has a policy exception, you can use SuiteScript and User Event Script. Here's a high-level overview of how you can achieve this: 1. Create a User Event Script: This script will be triggered when the expense report is being viewed. In this script, you will check each line of the expense report for policy exceptions. 2. Check for Policy Exceptions: For each line in the expense report, check if there is a policy exception. This can be done by checking the value of the 'custcol_policy_exception' field (or whatever custom field you are using to track policy exceptions). 3. Display a Banner: If a policy exception is found, use the
N/ui/message
module to create a banner message. This message will be displayed at the top of the expense report.
Here's a sample code snippet that demonstrates this:
javascript
/**
* @NApiVersion 2.x
* @NScriptType UserEventScript
*/
define(['N/ui/message'], function(message) {
function beforeLoad(context) {
if (context.type !== context.UserEventType.VIEW)
return;
var expenseReport = context.newRecord;
var lineCount = expenseReport.getLineCount({sublistId: 'expense'});
for (var i = 0; i < lineCount; i++) {
var policyException = expenseReport.getSublistValue({
sublistId: 'expense',
fieldId: 'custcol_policy_exception', // replace with your custom field id
line: i
});
if (policyException) {
var banner = message.create({
title: "Policy Exception",
message: "This expense report contains a policy exception.",
type: message.Type.WARNING
});
banner.show();
break;
}
}
}
return {
beforeLoad: beforeLoad
};
});
Please replace 'custcol_policy_exception'
with the actual ID of your custom field that tracks policy exceptions.
******
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
03/18/2025, 4:35 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.774475634
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.771974146
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.77181
Celigo AI
03/18/2025, 4:35 PM