Friday, November 2, 2018

Using API nlapiDisableLineItemField does not work on Sublists of type List

Using API nlapiDisableLineItemField() may not work as expected for the "List" type of Sublists.
This works on Sublist for Inline Editor/Editor sublist but not for sublists on Item Fulfillment, Item Receipt and Customer Payment
to name a few.
Note: Please check Scriptable Sublist on the Help Guide for complete list and it's types.

An API we can use to disable the line item fields for this type of Sublist is :

nlapiSetLineItemDisabled(type, fldnam, val ,linenum)

Parameters:
 type = sublist internal ID
 fldnam = name of the line item field to enable/disable
 val = true for disable ; false for enable
 linenum = line number for the field.

Code snippets:

~Sample for Item Fulfillment : Disable 'location' on the first line

  nlapiSetLineItemDisabled('item','location',true,1);
 

~Sample for Customer Payment : Disable 'Payment' column

  var itemCount = nlapiGetLineItemCount('apply');
  for ( var i = 1; i <= itemCount; i++)
  {
        nlapiSetLineItemDisabled('apply','amount',true,i);
  }


 

No comments:

Post a Comment