tarini
08/23/2024, 6:27 AMCeligo AI
08/23/2024, 6:28 AMAI generated answer (using internal Slack threads):Based on the conversations, it appears that it is not possible to directly remove an option from a native dropdown field in a record by script. However, there is a workaround that you can use: 1. Hide the native field that you want to edit the list of. 2. Create a new temporary field to hold the values you want. This can be done using a User Event (UE) script. 3. When you save the record, have a piece of code in beforeSubmit that copies the selected value in your custom field to the native field. Here is a sample code snippet provided in the conversation:
javascript
var newContField = scriptContext.form.addField({
id: 'custpage_contactfield',
type: serverWidget.FieldType.SELECT,
source: 'contact',
label: 'Contact V2',
layoutType: 'normal'
})
And in the Client Script (CS) pageInit:
javascript
function pageInit(scriptContext) {
var myRecord = scriptContext.currentRecord;
var newField = myRecord.getField({fieldId: 'custpage_contactfield'}); // field added through a UE BL script
newField.removeSelectOption({value: null, })
}
Please note that you cannot remove select options from a field that's sourced. You can only remove options if you use field.addSelectOption to add them.
******
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
08/23/2024, 6:28 AMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.848080814
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.84685123
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.841239095
Celigo AI
08/23/2024, 6:28 AM