Lev Berger
08/25/2022, 11:35 AMlet setDisable = curRecord.getSublistField({
sublistId: scriptContext.sublistId,
fieldId: obj.value,
line: scriptContext.line
});
setDisable.isDisabled = true
})
I tried using jQuery, when displaying the 3 sublist fields at once department/class/location and when the user is entering the segment field the other 2 will be set to disable but with no success it was too complected for my level
the data for the inserted select options is from lists department/class/location in vanilla NetSuite.
I open to any suggestion at this point.CD
08/25/2022, 11:49 AMbattk
08/25/2022, 11:49 AMbattk
08/25/2022, 11:50 AMbattk
08/25/2022, 11:50 AMbattk
08/25/2022, 11:51 AMLev Berger
08/25/2022, 12:08 PMbattk
08/25/2022, 12:10 PMbattk
08/25/2022, 12:13 PMbattk
08/25/2022, 12:22 PMfunction getSublistField(options, fieldId, line)
{
var sublistId,
undef = undefined;
if (fieldId !== undef && line !== undef)
{
sublistId = options;
}
else if (options !== undef && options !== null)
{
sublistId = options.sublistId;
fieldId = options.fieldId;
line = options.line;
}
utilityFunctions.checkArgs([sublistId, fieldId, line], ['sublistId', 'fieldId', 'line'], getMissingArgumentErrorMessageFillerValue('getSublistField'));
line = recordUtil.validateAndGetOneBasedIndex(line, "CurrentRecord.getSublistField", nlapiGetLineItemCount(sublistId));
var fldObj = nlapiGetLineItemField(sublistId, fieldId, line);
if (fldObj && fldObj.type === fieldTypeConstants.Type.TEXT && getEncodedFieldType(sublistId, fieldId, true) === fieldTypeConstants.Type.CHECKBOX)
fldObj.type = fieldTypeConstants.Type.CHECKBOX;
fldObj = fixMissingProperties(fldObj);
return fldObj ? field.create(fldObj, that) : null;
}
The above is the code for getSublistField, notably it uses nlapiGetLineItemField, which has the line as optional
if you can trick validateAndGetOneBasedIndex, then you can get the field
function validateAndGetOneBasedIndex(index, method, indexUpperLimit)
{
if (isNaN(index))
return index;
else
index = parseInt(index, 10);
if (index < 0 || (indexUpperLimit !== undefined && index >= indexUpperLimit))
{
throw error.create({name: error.Type.INVALID_SUBLIST_OPERATION, message: method});
}
else
{
return index + 1;
}
}
The code is not very good at validating, so it is possible to trick itLev Berger
08/25/2022, 2:05 PMvar objField11
var defaultField11
function pageInit(scriptContext) {
scriptContext.currentRecord.insertLine({
sublistId: 'cust_segment_rules_sublist_default',
line: 0,
ignoreRecalc: true
});
objField11 = scriptContext.currentRecord.getSublistField({
sublistId: `cust_segment_rules_sublist_default`,
fieldId: 'custrecord_st_segment_default',
line: 0
});
defaultField11 = scriptContext.currentRecord.getSublistField({
sublistId: `cust_segment_rules_sublist_default`,
fieldId: `custpage_default_value_default`,
line: 0
});
scriptContext.currentRecord.removeLine({
sublistId: 'cust_segment_rules_sublist_default',
line: 0,
ignoreRecalc: true
});
}
defaultField11.removeSelectOption({
value: null,
});
defaultField11.insertSelectOption({
value: option,
text: option
});
This worked Great!!!!!!!! Thank you battk 👏👏👏👏👏🎯