Hello all,
My JavaScript works without error or apparent issue, however it's not performing the last set of curly braces as expected, and wondering if someone more knowledgeable than I would know why its going wrong?
The test record is in the right status and I am using exclusively that security role GUID as my logged in user. Please find the code below:
function checkRole(executionContext) {
debugger;
var formContext = executionContext.getFormContext();
formContext.getControl('red_clarification').removeOption(283390000);
var userSecurityRoles = Xrm.Utility.getGlobalContext().userSettings.securityRoles;
var userRoleName = "{39847b08-e1c3-ea11-a812-000d3a86d6ea}"
// Checking if Security Role Id found in User Security Roles
for (var x = 0; x < userSecurityRoles.length; x++) {
if (userSecurityRoles[x]==userRoleName)
{
var status = formContext.getAttribute("red_status").getValue();
if (status == '283390001') {
formContext.getControl('red_clarification').addOption(283390000);
}
}
}
}