In my BeforeLoad Create event-triggered Workflow, ...
# ask-stanley-ai
a
In my BeforeLoad Create event-triggered Workflow, I need to check the lines of an Item Fulfillment after it loads, so see which Locations are set on each line. But when I assign a value to a workflow state field (freeform or checkbox) from any of the item lines in a Set Field Value workflow action, on either Entry or BeforeLoad, then displaying the workflow field's value later in a Before User Submit action of Show Message shows only null in the alert box, which makes it look like there was nothing in the list at the time the sublist action group executed. But there are items in the list by the time Before User Submit runs, it just doesn't let me use sublist action groups in Before User Submit. So how do I retrieve those values from the sublist when the user opens an Item Fulfillment creation page? I am not trying to WRITE to the item fulfillment's Items sublist. I am trying to READ from it, into a workflow state field. So don't say anything to me about how you can't write to sublists during beforeload in a workflow. That's not what I'm doing.
c
AI 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:
Copy code
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. ******
Slack 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
1
Please provide your feedback on this answer.
Thank you for your feedback