Aaron McCausland
12/03/2024, 9:44 PMCeligo AI
12/03/2024, 9:44 PMAI generated answer (using internal Slack threads):Based on the conversations, it seems that the location for a Sales Order in NetSuite is typically set by the location of the Employee's record or the location defined on the Customer record. However, for web store orders, you are encountering an issue where the Accounting Preferences are overriding the location set by a User Event Script. To resolve this, you could consider the following approach: 1. Create a custom field on the Customer record that will hold the location for web store orders. This field should be a list/record field with the source list being the list of locations. 2. Create a Workflow or a User Event Script that triggers on the creation of a Sales Order. This Workflow/Script should check if the order is being created from the web store. If it is, it should set the location on the Sales Order to the value in the custom field on the Customer record. Here is a pseudo-code example of how the User Event Script might look:
javascript
function beforeSubmit(context) {
if (context.type !== context.UserEventType.CREATE)
return;
var newRecord = context.newRecord;
var isWebStore = newRecord.getValue('custbody_web_store_order');
if (isWebStore) {
var customerId = newRecord.getValue('entity');
var customerRecord = record.load({
type: record.Type.CUSTOMER,
id: customerId
});
var webStoreLocation = customerRecord.getValue('custbody_web_store_location');
newRecord.setValue('location', webStoreLocation);
}
}
In this script, 'custbody_web_store_order' is a custom field on the Sales Order that indicates if the order is from the web store, and 'custbody_web_store_location' is the custom field on the Customer record that holds the location for web store orders.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
12/03/2024, 9:45 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.871822178
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.863520145
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.849913061
Celigo AI
12/03/2024, 9:45 PMCeligo AI
12/03/2024, 9:46 PM