To add the type of the class in script include is necessary or it can be optional
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2025 11:19 PM
var PersonalizedMarketingScriptInclude = Class.create();
PersonalizedMarketingScriptInclude.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getCustomerPreferences: function() {
try {
var customerId = this.getValue('sysparm_customer_id');
var gr = new GlideRecord('u_customer_interactions');
gr.addQuery('u_customer_ref', customerId);
gr.query();
var preferences = [];
while (gr.next()) {
var preference = {
productCategory: gr.u_product_category,
interactionType: gr.u_interaction_type,
customerName: gr.u_customer_ref.u_name,
customerEmail: gr.u_customer_ref.u_email,
customerPreferences: gr.u_customer_ref.u_product_preferences
};
preferences.push(preference);
}
return JSON.stringify({ preferences: preferences });
} catch (e) {
return JSON.stringify({ error: 'Error fetching customer preferences: ' + e.message });
}
}
});
1 REPLY 1

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-15-2025 10:00 AM
Hi,
It's not strictly necessary, but there are some platform features/validation that may attempt to access the value. For consistency, I would keep it in.