The function to know if the current line is a free gift or the line is the part of promotion:
Method 1:
let isCurrentItemFreeGift = currentRec.getCurrentSublistValue({
sublistId: ‘item’,
fieldId: ‘freegiftpromotion’
});
Method 2:
let checkCurrentDiscountItemIsForPromotion = currentRec.getSublistValue({
sublistId: ‘item’,
fieldId: ‘custreferralcode’,
line: currentLines
});
‘checkCurrentDiscountItemIsForPromotion’ will provide the internal id of the promotion record.