SunShine
02/05/2025, 6:47 PMCeligo AI
02/05/2025, 6:47 PMAI generated answer (using internal Slack threads):To get and print the customer's phone number and email to the sales order template, you can use the following steps: 1. Create custom fields on the Sales Order record for the customer's phone number and email. You can do this by going to
Customization > Lists, Records, & Fields > Transaction Body Fields > New
. Make sure to apply the fields to Sales Order and mark them as Store Value
.
2. Use a User Event script or a Workflow to populate these fields when the Sales Order is created or edited. In the script or workflow, you would load the customer record associated with the Sales Order, get the email and phone number, and then set those values in the custom fields you created on the Sales Order.
Here is a sample SuiteScript 2.0 code for a User Event script:
javascript
define(['N/record'], function(record) {
function beforeSubmit(context) {
if (context.type !== context.UserEventType.CREATE && context.type !== context.UserEventType.EDIT) {
return;
}
var salesOrder = context.newRecord;
var customerId = salesOrder.getValue('entity');
var customer = record.load({
type: record.Type.CUSTOMER,
id: customerId
});
var email = customer.getValue('email');
var phone = customer.getValue('phone');
salesOrder.setValue('custbody_email', email);
salesOrder.setValue('custbody_phone', phone);
}
return {
beforeSubmit: beforeSubmit
};
});
3. In your Advanced PDF/HTML template for the Sales Order, you can then reference these custom fields to display the customer's email and phone number. The syntax would be something like ${record.custbody_email}
and ${record.custbody_phone}
.
Please replace 'custbody_email' and 'custbody_phone' with the actual IDs of the custom fields you created.
******
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
02/05/2025, 6:47 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.831109583
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.827599049
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.823770702
Celigo AI
02/05/2025, 6:47 PM