What value is passed to the sublistId when a custb...
# ask-stanley-ai
d
What value is passed to the sublistId when a custbody field triggers a fieldChanged event in a client script?
c
AI generated answer (using internal Slack threads):
When a
custbody
field triggers a
fieldChanged
event in a client script, the value passed to the
sublistId
is typically the ID of the sublist where the change occurred. However, if the
fieldChanged
event is triggered by a change in a body field (like a
custbody
field), the
sublistId
will be
null
because the change did not occur on a sublist. Here is an example of how the
fieldChanged
function might look:
Copy code
javascript
function fieldChanged(context) {
    var currentRecord = context.currentRecord;
    var sublistName = context.sublistId;
    var sublistFieldName = context.fieldId;
    var line = context.line;
    if (sublistName === 'item' && sublistFieldName === 'item')
        currentRecord.setValue({
            fieldId: 'memo',
            value: 'Item: ' + currentRecord.getCurrentSublistValue({
                sublistId: 'item',
                fieldId: 'item'
            }) + ' is selected'
        });
}
In this example, if the
fieldChanged
event is triggered by a change in the
item
field on the
item
sublist, the
sublistId
will be
'item'
. If the
fieldChanged
event is triggered by a change in a
custbody
field, the
sublistId
will be
null
. ****** 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.855744243
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.855521739
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.849657
Please provide your feedback on this answer.