Rob
09/10/2024, 1:59 PMCeligo AI
09/10/2024, 2:00 PMAI generated answer (using internal Slack threads):****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ****** To remove the mandatory requirement from a column of a sublist with a user event, you would need to use SuiteScript. However, it's important to note that the
isMandatory
property of a sublist field is read-only, meaning you cannot directly change it through SuiteScript.
A common workaround for this is to use a user event script with the beforeSubmit
event. In this event, you can add a validation check for the sublist field. If the field is empty or null, you can throw an error to prevent the record from being saved. This effectively makes the field mandatory.
Here is a basic example of how you might implement this:
javascript
function beforeSubmit(scriptContext) {
var record = scriptContext.newRecord;
var sublistLineCount = record.getLineCount({sublistId: 'your_sublist_id'});
for (var i = 0; i < sublistLineCount; i++) {
var sublistFieldValue = record.getSublistValue({
sublistId: 'your_sublist_id',
fieldId: 'your_field_id',
line: i
});
if (!sublistFieldValue) {
throw new Error('The field is mandatory.');
}
}
}
Remember to replace 'your_sublist_id'
and 'your_field_id'
with the actual ID of your sublist and field.
Please note that this solution will only work for user interactions and CSV imports, not for other automations or integrations. For those, you might need to implement similar validation checks in the respective scripts or workflows.Celigo AI
09/10/2024, 2:01 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.807745218
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.795408547
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.794160843
Celigo AI
09/10/2024, 2:01 PM