Skip to main content
Question

Web Client Script Not Working

  • January 19, 2026
  • 7 replies
  • 39 views

Forum|alt.badge.img+8

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);

 

7 replies

Shneor Cheshin
Superhero (Employee)
Forum|alt.badge.img+28
  • Superhero (Employee)
  • January 19, 2026

Hi ​@qquac 

Why do you need both events? Why not use only After Data Load?

According to the documentation, “This event is similar to AfterDataLoad, but only executes once.

Cheers!


Forum|alt.badge.img+8
  • Author
  • Sidekick (Customer)
  • January 19, 2026

Hi ​@qquac 

Why do you need both events? Why not use only After Data Load?

According to the documentation, “This event is similar to AfterDataLoad, but only executes once.

Cheers!

Hi Shneor Cheshin,

The reason for both client scripts is that AddEditOpened would ensure the client script would populate the drop down first and any changes would be handled by the AfterDataLoad client script.


Shneor Cheshin
Superhero (Employee)
Forum|alt.badge.img+28
  • Superhero (Employee)
  • January 19, 2026

Hi ​@qquac 

Why do you need both events? Why not use only After Data Load?

According to the documentation, “This event is similar to AfterDataLoad, but only executes once.

Cheers!

Hi Shneor Cheshin,

The reason for both client scripts is that AddEditOpened would ensure the client script would populate the drop down first and any changes would be handled by the AfterDataLoad client script.

Soryy ​@qquac 

I am not following the logic here.

If you remove the AddEditOpened event, does it work as expected?

Cheers!


Forum|alt.badge.img+8
  • Author
  • Sidekick (Customer)
  • January 20, 2026

Hi ​@qquac 

Why do you need both events? Why not use only After Data Load?

According to the documentation, “This event is similar to AfterDataLoad, but only executes once.

Cheers!

Hi Shneor Cheshin,

The reason for both client scripts is that AddEditOpened would ensure the client script would populate the drop down first and any changes would be handled by the AfterDataLoad client script.

Soryy ​@qquac 

I am not following the logic here.

If you remove the AddEditOpened event, does it work as expected?

Cheers!

Hi ​@Shneor Cheshin 

After removing AddEditOpened, it worked; however, after I switch task_status, APPOINTMENT appears.

eg task_status is already OPEN. I changed it to ASSIGNED, click save, and APPOINTMENT appears in the list.


Shneor Cheshin
Superhero (Employee)
Forum|alt.badge.img+28
  • Superhero (Employee)
  • January 20, 2026

Hi ​@qquac 

Why do you need both events? Why not use only After Data Load?

According to the documentation, “This event is similar to AfterDataLoad, but only executes once.

Cheers!

Hi Shneor Cheshin,

The reason for both client scripts is that AddEditOpened would ensure the client script would populate the drop down first and any changes would be handled by the AfterDataLoad client script.

Soryy ​@qquac 

I am not following the logic here.

If you remove the AddEditOpened event, does it work as expected?

Cheers!

Hi ​@Shneor Cheshin 

After removing AddEditOpened, it worked; however, after I switch task_status, APPOINTMENT appears.

eg task_status is already OPEN. I changed it to ASSIGNED, click save, and APPOINTMENT appears in the list.

Hi ​@qquac 

Try adding the same script/logic to the after value change event on the task_status column/field in the webclient. 

  1. ‘After data load ‘event will take care of screen refresh.
  2. ‘After value change’ event will take care of value updates where the screen not yet refreshed.

You might have other scenarios to cover, depending on the specific workflow and requirements.

Cheers!


Forum|alt.badge.img+8
  • Author
  • Sidekick (Customer)
  • January 21, 2026

Hi ​@qquac 

Why do you need both events? Why not use only After Data Load?

According to the documentation, “This event is similar to AfterDataLoad, but only executes once.

Cheers!

Hi Shneor Cheshin,

The reason for both client scripts is that AddEditOpened would ensure the client script would populate the drop down first and any changes would be handled by the AfterDataLoad client script.

Soryy ​@qquac 

I am not following the logic here.

If you remove the AddEditOpened event, does it work as expected?

Cheers!

Hi ​@Shneor Cheshin 

After removing AddEditOpened, it worked; however, after I switch task_status, APPOINTMENT appears.

eg task_status is already OPEN. I changed it to ASSIGNED, click save, and APPOINTMENT appears in the list.

Hi ​@qquac 

Try adding the same script/logic to the after value change event on the task_status column/field in the webclient. 

  1. ‘After data load ‘event will take care of screen refresh.
  2. ‘After value change’ event will take care of value updates where the screen not yet refreshed.

You might have other scenarios to cover, depending on the specific workflow and requirements.

Cheers!

Hi ​@Shneor Cheshin ,

APPOINTMENT is still showing up for a user, but not for myself.


Shneor Cheshin
Superhero (Employee)
Forum|alt.badge.img+28
  • Superhero (Employee)
  • January 22, 2026

Hi ​@qquac 

This requires some more troubleshooting. Unfortunately, only you can do that.

It is probably related to the different roles assigned to each one of the users. I would start by comparing the users to be identical 100%, and change one thing at a time. Unless you can see any obvious restriction on the other role(s)

Cheers!