Ajith Kumaran
03/27/2025, 1:44 PMCeligo AI
03/27/2025, 1:44 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. ****** Yes, you can set a default value for a subrecord using a client script. The client script entry points for a parent record will also trigger for the subrecord. However, it's important to note that this will only work when the subrecord is being created or edited, not after it has been saved and doesn't have an ID yet. Here is a code snippet that was shared in the conversation, which sets a default value for a sublist line. Please replace 'sublistID' and 'fieldId' with your actual sublist ID and field ID:
javascript
function validateLine(scriptContext) {
var currentRecord = scriptContext.currentRecord;
var currIndex = currentRecord.getCurrentSublistIndex({
sublistId: ‘sublistID’
});
var lineNum = currentRecord.selectLine({
sublistId: 'sublistID',
line: currIndex
});
currentRecord.setCurrentSublistValue({
sublistId: 'sublistID',
fieldId: 'fieldId',
value: currIndex + 1,
ignoreFieldChange: true
});
currentRecord.commitLine({
sublistId: 'sublistID'
});
}
This script will trigger as soon as you click on the line.Celigo AI
03/27/2025, 1:44 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.838493049
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.836582601
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.836336911
Celigo AI
03/27/2025, 1:44 PM