Imran Hasan
12/27/2024, 3:03 PMCeligo AI
12/27/2024, 3:03 PMAI generated answer (using internal Slack threads):In a beforeSubmit User Event script, you can indeed add a new line to a sublist, but the methods used are different than in a client-side script. The newRecord object in a beforeSubmit User Event script is not in dynamic mode, so methods like
selectNewLine()
will not work. Instead, you should use the setSublistValue()
method.
Here's an example of how you can add a new line to a sublist in a beforeSubmit User Event script:
javascript
newRecord.setSublistValue({
sublistId: 'salesteam',
fieldId: 'employee',
value: 1,
line: nextLineIndex
});
In this example, nextLineIndex
should be the index of the new line you want to add. Note that sublist line indices are zero-based, so if there is currently 1 line in the sublist, nextLineIndex
should be 1 to add a new line after the existing one.
Remember, you don't need to use insertLine()
unless you want to insert a new line between existing lines. If you just want to add a new line at the end of the sublist, setSublistValue()
with the appropriate line index is sufficient.
******
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
12/27/2024, 3:03 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.822583616
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.79723984
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.796482325
Celigo AI
12/27/2024, 3:03 PM