How to get fields in Items in Vendor to show in Vendors section in Inventory Item
Is there a way to pull in the Date Created and Last Modified fields that are found in Vendor->Financial->Items to be shown in Inventory Item-Purchasing/Inventory->Vendors?
We sell many items with multiple vendors. It would be nice to quickly see how old the prices are based on when the vendor price was last updated. Is this doable or should it be done another way?
Yes, it is possible to pull in the Date Created and Last Modified fields that are found in Vendor->Financial->Items to be shown in Inventory Item-Purchasing/Inventory->Vendors. This can be done by using a custom script or by creating a custom view.
Using a custom script
- Create a custom script that retrieves the Date Created and Last Modified fields from Vendor->Financial->Items.
- The script should then update the Inventory Item-Purchasing/Inventory->Vendors record with the retrieved dates.
Creating a custom view
- Create a custom view of the Inventory Item-Purchasing/Inventory->Vendors record.
- Add the Date Created and Last Modified fields to the custom view.
Which method is better?
The best method for you will depend on your specific needs. If you need the dates to be updated automatically, then using a custom script is the best option. If you only need to see the dates occasionally, then creating a custom view is a good option.
Here is an example of how to create a custom script to pull in the Date Created and Last Modified fields that are found in Vendor->Financial->Items to be shown in Inventory Item-Purchasing/Inventory->Vendors:
var record = nlapiGetRecord('item', itemId);
var vendorId = record.getFieldValue('vendor');
var vendorRecord = nlapiGetRecord('vendor', vendorId);
var dateCreated = vendorRecord.getFieldValue('datecreated');
var lastModified = vendorRecord.getFieldValue('lastmodified');
var inventoryRecord = nlapiGetRecord('inventoryitem', itemId);
inventoryRecord.setFieldValue('datecreated', dateCreated);
inventoryRecord.setFieldValue('lastmodified', lastModified);
nlapiSubmitRecord(inventoryRecord);
This script will retrieve the Date Created and Last Modified fields from the Vendor record for the specified item ID and update the Inventory Item record with the retrieved dates.
Here is an example of how to create a custom view of the Inventory Item-Purchasing/Inventory->Vendors record:
- Go to Lists > Custom > Views.
- Click New.
- In the Type field, select Inventory Item.
- In the Name field, enter a name for the custom view.
- In the Fields section, add the Date Created and Last Modified fields.
- Click Save.
This will create a custom view of the Inventory Item-Purchasing/Inventory->Vendors record that includes the Date Created and Last Modified fields.
I believe he is referring to adding columns to the itemvendor sublist.