Hello,
I’m having an issue with a web client script. The script checks the current task_status and builds a dropdown list based on that value.
-
If task_status = 'APPOINTMENT', the dropdown should include APPOINTMENT.
-
If task_status ≠ 'APPOINTMENT', then APPOINTMENT should be excluded.
Test 1: When I test this using my own role, the script behaves correctly. However, when I switch to another role, it no longer works—even though both roles use the same screen configuration and the same function.
Test 2: If I add an alert statement inside the script, it suddenly works for both roles.
On the Screen it is set to: AddEditOpened and AfterDataLoad.

Web Client Script
var taskStatus = getControlValue('task', 'task_status');
var opt1 = [];
if(taskStatus == 'APPOINTMENT') {
arrayPush(opt1, createCodeTableOption('APPOINTMENT', getMessage('APPOINTMENT', 'CODE')));
}
arrayPush(opt1, createCodeTableOption('ARRIVED', getMessage('ARRIVED', 'CODE')));
arrayPush(opt1, createCodeTableOption('ASSIGNED', getMessage('ASSIGNED', 'CODE')));
arrayPush(opt1, createCodeTableOption('CANCELED', getMessage('CANCELED', 'CODE')));
arrayPush(opt1, createCodeTableOption('COMMITTED', getMessage('COMMITTED', 'CODE')));
arrayPush(opt1, createCodeTableOption('COMPLETED', getMessage('COMPLETED', 'CODE')));
arrayPush(opt1, createCodeTableOption('COMPLETED-REVIEW', getMessage('CompletedReview', 'CODE')));
arrayPush(opt1, createCodeTableOption('ENROUTE', getMessage('ENROUTE', 'CODE')));
arrayPush(opt1, createCodeTableOption('HOLD', getMessage('HOLD', 'CODE')));
arrayPush(opt1, createCodeTableOption('IN PROCESS', getMessage('InProcess', 'CODE')));
arrayPush(opt1, createCodeTableOption('OPEN', getMessage('OPEN', 'CODE')));
arrayPush(opt1, createCodeTableOption('PICK-UP PARTS END', getMessage('TS_PU_PARTS_END', 'CODE')));
arrayPush(opt1, createCodeTableOption('PICK-UP PARTS START', getMessage('TS_PU_PARTS_START', 'CODE')));
arrayPush(opt1, createCodeTableOption('RESCHEDULE', getMessage('RESCHEDULE', 'CODE')));
arrayPush(opt1, createCodeTableOption('SUSPEND', getMessage('SUSPEND', 'CODE')));
setControlOptions('task','task_status', opt1);