mg2017
09/07/2020, 2:15 PMmg2017
09/07/2020, 3:23 PMerictgrubaugh
09/07/2020, 3:51 PMprice_level_id and customer_pl_id are both 122 , then you should hit the if, not the elseerictgrubaugh
09/07/2020, 4:36 PMelse given your statements. If that's the entirety of your validateLine, then I'd expect you would see an alert with Match and then the line would not commit since you are not returning true anywheremg2017
09/07/2020, 10:20 PMfunction validateLine(context) {
var transaction = context.currentRecord;
/**Screen Messages**/
var new_price_level = {
title: 'PRICE LEVEL CHANGES',
message: 'Price Level must not be different to the price level set on the customer record.'
};
var entity_id = transaction.getValue({
fieldId: 'entity'
});
var customer_pl = search.lookupFields({
type: search.Type.CUSTOMER,
id: entity_id,
columns: 'pricelevel'
});
alert(customer_pl.pricelevel[0].value);
var price_level = transaction.getCurrentSublistValue({
sublistId: "item",
fieldId: "price",
});
alert( price_level);
var customer_pl_id = parseInt(customer_pl);
var price_level_id = parseInt(price_level);
if (price_level_id === customer_pl_id) {
alert("Match");
}
else {
alert("No Match")
return false;
}
return true;
}mg2017
09/07/2020, 10:21 PMcreece
09/07/2020, 10:42 PMcreece
09/07/2020, 10:44 PMvar customer_pl_id = parseInt(customer_pl.pricelevel[0].value);
var price_level_id = parseInt(price_level);mg2017
09/07/2020, 10:58 PM