If the User Event script is deployed to "Run as Admin", it can grant more permissions and do more powerful things at the time of executing the script. As a result, those 2 fields are visible.
Sample Code:
function userEventAfterSubmit(type){
newRecord = nlapiLoadRecord(nlapiGetRecordType(), nlapiGetRecordId());
var linecount = newRecord.getLineItemCount('item');
for (var i = 1; i <= linecount; i++){
var qtyavailable = newRecord.getLineItemValue('item', 'quantityavailable', i);
nlapiLogExecution('DEBUG','qtyavailable = '+qtyavailable);
var backordered = newRecord.getLineItemValue('item', 'quantitybackordered', i);
nlapiLogExecution('DEBUG','backordered = '+backordered);
}
}
- Upload the script above via Customization > Scripting > Scripts > New as a User Event script and fill out all mandatory fields.
- Once the script record is created click on the Deploy Script button.
- Make sure that Execute as Admin field is checked.
Tuesday, February 5, 2019
Get Value of quantitybackordered and quantityavailable via Script when Sales Order is Created in the Web Store
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment