When I apply the client script attached to the Sales Order, I am unable to add a line when "No consolidated shipments"(the hidden custom line field) is checked.
Please let me know if you have any ideas as to the cause and remedies for this problem.
- Operation Procedure
1. On the Salse Order form, Select the item that the checkbox for "Not for consolidated shipment" in the Item record is set to "True".
(Then depending on the source, the hidden custom line field "No consolidated shipments" will also be set to "True".
2. Select the required fields and click "Add".
3. The line is not fixed, and the line returns to the editing state.
- Things I've tried
I can add a line by commenting out the following function in the clientcript's sublistChanged entry point.
- script
function sublistChanged(scriptContext) {
const currentRecord = scriptContext.currentRecord;
selectDeliveryCompanyForNormalDeliverySublistChanged(currentRecord);
}
function selectDeliveryCompanyForNormalDeliverySublistChanged(currentRecord) {
const itemLineCount = currentRecord.getLineCount(SUBLIST_ID_ITEM);
for (var idx = 0; idx < itemLineCount; idx++){
var cannotconsolidatedshipment = currentRecord.getSublistValue({
sublistId : SUBLIST_ID_ITEM,
fieldId: 'custcol_cannotconsolidatedshipment',
line : idx
});
// End the process if there are any items that are not allowed for consolidated shipment.
if(cannotconsolidatedshipment){
return;
}
}
// The following lines have not been passed
const deliveryCompany = currentRecord.getValue('custbody_deliverycompany');
const addressRecord = currentRecord.getSubrecord('shippingaddress');
if (deliveryCompany == DELIVERY_COMPANY_ID_CHARTER) {
var addressDeliveryCompany;
if (addressRecord) {
addressDeliveryCompany = addressRecord.getValue('custrecord_address_deliverycompany');
} else {
addressDeliveryCompany = '';
}
currentRecord.setValue({
fieldId : 'custbody_deliverycompany',
value : addressDeliveryCompany
});
}
}
I'm waiting for your help.