Aaron McCausland
01/29/2025, 4:45 PMCeligo AI
01/29/2025, 4:45 PMAI generated answer (using internal Slack threads):Based on the conversations, it seems that you are trying to read from a sublist in a BeforeLoad event of a workflow. However, it's important to note that the sublist values are not available during the BeforeLoad event. The BeforeLoad event is triggered before the record is loaded into the browser, and at this point, the sublist values are not yet available. This is why you are seeing null values when you try to access the sublist values in a BeforeLoad event. If you need to access the sublist values, you can do so in a BeforeSubmit or AfterSubmit event. In these events, the sublist values are available and can be accessed. Here is a sample code snippet that shows how to access sublist values in a BeforeSubmit event:
javascript
function beforeSubmit(scriptContext) {
var record = scriptContext.newRecord;
var lineCount = record.getLineCount({sublistId: 'item'});
for (var i = 0; i < lineCount; i++) {
var location = record.getSublistValue({
sublistId: 'item',
fieldId: 'location',
line: i
});
// Do something with the location
}
}
In this code snippet, we are looping through each line in the 'item' sublist and getting the value of the 'location' field.
Remember, you cannot write to the sublist in a BeforeLoad event, but you can read from it in a BeforeSubmit or AfterSubmit event.
******
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
01/29/2025, 4:46 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.84664166
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.842977524
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.838002801
Celigo AI
01/29/2025, 4:46 PMCeligo AI
01/29/2025, 4:47 PM