NS User
03/21/2025, 8:01 PMCeligo AI
03/21/2025, 8:02 PMAI generated answer (using internal Slack threads):To make a custom segment field mandatory on a sales order line level, you can use either a Client Script or a Workflow. If you choose to use a Client Script, you can use the
validateLine
or validateInsert
function to check if the field is filled in before the line is submitted. If the field is empty, you can return false
to prevent the line from being added or edited.
Here is a sample code snippet for a Client Script:
javascript
function validateLine(type) {
if (type == 'item') {
var customField = nlapiGetCurrentLineItemValue('item', 'custcol_your_custom_field');
if (!customField) {
alert('Please fill in the custom field.');
return false;
}
}
return true;
}
If you choose to use a Workflow, you can create a State with a Condition that checks if the field is filled in. If the field is empty, you can show a message to the user and prevent the sales order from being saved.
Here is a sample setup for a Workflow:
1. Create a new Workflow with Record Type 'Sales Order'.
2. Add a State.
3. Add a Condition to the State with the formula CASE WHEN {line.custcol_your_custom_field} IS NULL THEN 1 ELSE 0 END
.
4. Add an Action to show a message if the Condition is met.
Please replace 'custcol_your_custom_field'
with the actual ID of your custom field.
******
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/21/2025, 8:02 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.857969
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.853278518
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.844470561
Celigo AI
03/21/2025, 8:02 PM