- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago
// Get ELID from system property
var elidProperty = gs.getProperty('wf.change.tcm.vendor.certification.users');
// Default name fallback
var username = '';
if (elidProperty) {
// Process comma-separated values to remove spaces
var idList = elidProperty.split(',').map(function(id) {
return id.trim();
}).join(',');
var userGR = new GlideRecord('sys_user');
// Construct an explicit Encoded Query string using the IN operator
// This translates to: (u_elid IN idList OR user_name IN idList) AND active=true
var queryString = "u_elidIN" + idList + "^ORuser_nameIN" + idList + "^active=true";
userGR.addEncodedQuery(queryString);
userGR.query();
if (userGR.next()) {
username = userGR.getValue('name'); // Safeguards field reference
}
}
// Build message content
var emailContent = '';
emailContent += '<br/>';
// Execute clean ternary string concatenation
var displayName = username ? username : '';
emailContent += '<p>Hi ' + displayName + ',</p>';
emailContent += '<p>As the manager of a group with access to the Vendor Change mod review and attestation.</p>';
// ... rest of your html code ...
template.print(emailContent);