GET THE LIST FIELD VALUES USING CLENT SCRIPT

This is an example of the client script that retrieves the values of the list. the example logs the values of the sublist list field price level when the record is loaded.

function pageInit(scriptContext) {
            try {
                let recordObj = scriptContext.currentRecord;
                let itemPricingSublistId = 'itempricing';
                let itemFieldId = 'level';
        
                // Attempt to fetch options directly from the item field
                let itemField = recordObj.getSublistField({
                    sublistId: itemPricingSublistId,
                    fieldId: itemFieldId,
                    line: 0
                });
        
                if (itemField) {
                    let itemOptions = itemField.getSelectOptions();
                    console.log('Item Options:', itemOptions);
                } else {
                    console.log('Item Field not found in the sublist.');
                }
            } catch (e) {
                console.error('Error in pageInit', e);
            }
        } 

Leave a comment

Your email address will not be published. Required fields are marked *