Customer would want to add/update the vendor list via WS but seems to be unable to do this on Item of type : Assembly Items
Note: Vendor list on an Item record is not documented yet as a scriptable sublist, but code seems to work.
1. Create custom fields that will temporarily contain values for the Vendor list.
custitem_vendorid --> vendor
custitem_vendor_purchprice --> purchaseprice
custitem_vendor_if_preferred --> preferredvendor
2. Create a script that will pass on these values on the actual Vendor list.
Setup>Customization>Script New>User Event>
Script on Event = Before Submit
Deploy on Record Type = Build/Assembly Item
Note: Triggered within Context 'webservices' upon 'Create' and 'Edit' mode of the Assembly record.
Sample script:
var currentContext = nlapiGetContext();
if ((currentContext.getExecutionContext() == 'webservices') && (type == 'edit' | type == 'create')) {
nVendorID = nlapiGetFieldValue('custitem_vendorid');
dVendorPrice = nlapiGetFieldValue('custitem_vendor_purchprice');
bVendorPref = nlapiGetFieldValue('custitem_vendor_if_preferred');
nlapiSetLineItemValue('itemvendor', 'vendor',1, nVendorID);
nlapiSetLineItemValue('itemvendor', 'purchaseprice',1, dVendorPrice);
nlapiSetLineItemValue('itemvendor', 'preferredvendor',1, bVendorPref);
}
}
- Script copies the values from these custom fields whenever the WS call/update is invoked.
No comments:
Post a Comment