//greg
11/26/2024, 10:25 PMCeligo AI
11/26/2024, 10:25 PMAI generated answer (using internal Slack threads):To set a user's email subscription in the My Account section to confirmed opt-out, you can follow these steps: 1. Create a hidden checkbox field on the customer record, let's call it
xyz_unsubscribe
.
2. Create a Suitelet script that takes the email data, performs a search, and sets xyz_unsubscribe
to true for the corresponding customer.
3. In your email template, add a "click to unsubscribe" link that points to the Suitelet URL.
When the customer clicks on the unsubscribe link, the Suitelet will be triggered, setting the xyz_unsubscribe
field to true. This effectively opts the customer out of future emails.
Here's a sample SuiteScript code for the Suitelet:
javascript
function suitelet(request, response){
var customerId = request.getParameter('custId');
var customerRecord = nlapiLoadRecord('customer', customerId);
customerRecord.setFieldValue('xyz_unsubscribe', 'T');
nlapiSubmitRecord(customerRecord);
}
Please replace 'custId'
with the actual parameter name you're using to pass the customer ID in the URL.
******
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
11/26/2024, 10:26 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.808231831
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.797201753
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.794750452
Celigo AI
11/26/2024, 10:26 PM