Item Fulfillment showing Total Amount of Lines Using SuiteScript
- Create a new custom transaction column field according to SuiteAnswers article (13937): "Display the Total Amount for Each Line in the Item Fulfillment". Enter the field ID, e.g. "lineamount".
- Create a new Transaction Body Field
- Navigate to Customization > Transaction Body Fields > New
- Label the field
- Set the ID field e.g. "totalitemamount"
- Set Type to Currency
- Store Value set as unchecked
- Applies To subtab > Item Fulfillment checked
- Display subtab > Subtab set to Items
- Display subtab > Display Type set as Inline Text
- Click Save
- The New Script
- Create a new User Event script as follows
function eventBeforeLoad(type, form, request){ var lineamount = 0; //set the counter var lines = nlapiGetLineItemCount('item'); //access the items tab // use for loop to go through all the items on item subtab for(var i = 1; i <= lines; i++){ // sum the amount of the line lineamount = lineamount + parseFloat(nlapiGetLineItemValue('item', 'custcollineamount' , i)); } // save the value into the custom body field nlapiSetFieldValue('custbodytotalitemamount', lineamount); }
- Deploy the script on Item Fulfillment page
- Create a new User Event script as follows
No comments:
Post a Comment