Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Using angular ng-repeat in UI Action GlideModal

davilu
Mega Sage

Our team is trying to build an UI Action on case records that brings up a modal with dropdown of selectable email addresses.  The dropdown of email addresses should include users who have the HR user skill.  Is there a way to use ng-repeat to loop through an array of users in this dropdown?  If we can't use angular ng-repeat, is there another way to achieve this?

 

Here is the client side script we have so far:

function emailHC() { 
var gm = new GlideModal('emailHCModal'); 
gm.setTitle('Email HC'); 
var str = '<div style="padding:15px">' + 
'<p>' + 
'<select name="tagging" id="tagPopUp" class="form-control">' + 
'<option ng-repeat="x in getUsers()" value="{{x.name}}" role="option">{{x.email}}</option>' + 
'</select>' + 
'</p>' + 
'<p>' + 
'<label for="commentTextArea">Reasons for Emailing TSA Human Capital</label>' + 
'<textarea class="form-control" id="commentTextArea" rows="3"></textarea>' + 
'</p>' + 
'<div style="padding:5px;float:right">' + 
'<button style="padding:5px;margin-right:10px" class="btn btn-primary" onclick="window.reasonForReturnTaskAction(this.innerHTML,jQuery(\'#commentTextArea\').val())">Enter</button>' + 
'<button style="padding:5px" class="btn btn-default" onclick="window.reasonForReturnTaskAction(this.innerHTML,\'\')">Cancel</button>' + 
'</div>' + 
'</div>' 
gm.renderWithContent(str); 
window.reasonForReturnTaskAction = function(thisButton, commentText) { 
if (thisButton == 'Cancel') { 
gm.destroy(); 
} else if (thisButton == 'Enter') { 
if (commentText == '') {
alert('Reasons for Emailing TSA Human Capital are required.'); 
} else { 
gm.destroy(); 
g_form.setValue('work_notes', 'Reasons for Emailing TSA Human Capital: ' + commentText); 
gsftSubmit(null, g_form.getFormElement(), 'email_hc'); 
} 
} 
}; 
return false;
}

 Here is the server side:

if (typeof window == 'undefined') { 
updateTask(); 
} 

function updateTask() { 
current.update(); 
var hcscQaService = new sn_hr_core.hcscQaService; 
var processedBy = gs.getUser().getID(); 
hcscQaService.routeToHcExecutives(current, processedBy); 
}

function getUsers() { 
var arr = []; 
var gr = new GlideRecord('sys_user_has_skill'); 
gr.addEncodedQuery('active=true^skill.name=HR'); 
gr.query(); 
while (gr.next()) { 
var user_sysID = gr.user.getRefRecord(); 
arr.push({ 
name: gr.getDisplayValue('user'), 
email: user_sysID.email 
}); 
}
return arr; 
}
0 REPLIES 0