This topic contains 0 replies, has 0 voices, and was last updated by David_Jarrell 7 years, 2 months ago.
-
AuthorPosts
-
August 31, 2017 at 2:50 pm #21417
David_JarrellHi All,
I just discovered today that the behavior of the now standard Customer field "Last Sales Order Date" is a little misleading, at least to me. It sounds like it would record the date on which the order was entered or the transaction date of the order but it doesn't. It actually records the date on which the order was approved and not the date on which it was first entered into NetSuite. While it's generally not good practice to leave unapproved orders out there for long periods of time, sometimes it happens anyway and a reliable method of determining last sales order activity is needed.
Since this is a problem in the current environment in which I'm working I developed a slight workaround that will update a custom field on the Customer record whenever a new Sales Order is actually create for that Customer regardless of the approval status.
I looked in the forums on this topic and also saw people requesting a way to tell when the last Sales Order Approval for a Customer was. Well, the standard field "Last Sales Order Date" is essentially that and could be called "Last Sales Order Approval Date" as well.
To employ this workaround, first create a new Entity custom field called "Last Sales Order Entry Date" of data type Date. Then deploy the script below as a User Event script that fires on the After Submit function.
function lastSalesOrderEntryDate(type)
{
if (type == 'create')
{
var d = new Date();
var m = (d.getMonth())+1
var dd = d.getDate();
var y = d.getFullYear();
var now = m+'/'+dd+'/'+y;
var newId = nlapiGetRecordId();
var newType = nlapiGetRecordType();
var record = nlapiLoadRecord(newType,newId);
var customerid = record.getFieldValue('entity');
nlapiSubmitField('customer',customerid,'custentity _lastsaledate', now)
}
}
Hopefully this helps someone out there.
This is a cached copy. Click here to see the original post. -
AuthorPosts
You must be logged in to reply to this topic.