client script in catalog task works in native view but not in workspace view

imran rasheed
Tera Contributor

we have a catalog where the variable should be updated only when closing a catalog task. Hence we created a client script in sc task table. This work perfectly fine in native view of the ticket, but it doesn't show the variable mandatory in workspace view. In client script, isolate script is also checked.

what could be the reason.?

Onchange client script:

field name:state

script:

 

 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue === '') {
        return;
    }
    var cat_item = g_form.getValue('u_item');
    var service = g_form.getValue('abc');
    var state = g_form.getValue('state');
    if (cat_item == 'test' && service == 'log' && newValue == '3') {
        g_form.setVisible("bc", true);
        g_form.setMandatory('bc', true);

        g_form.setVisible("index", true);
        g_form.setMandatory('index', true);

        g_form.setVisible("ui", true);
        g_form.setMandatory('ui', true);

    } else {
        g_form.setMandatory('bc', false);
        g_form.setMandatory('index', false);
        g_form.setMandatory('ui', false);
    }
4 REPLIES 4

Anurag Tripathi
Mega Patron
Mega Patron

What is the uI type on the client script? Make sure it is set to All.

AnuragTripathi_0-1719491508789.png

 

Also make sure it is Global. (Global checkbox is set to true). If this is not true then it means that this Client script is set to work in a particular View Only (workspace is a different view)

-Anurag

imran rasheed
Tera Contributor

@Anurag Tripathi  UI Type "All" is set as well. I tried having it in global and also tried with sow view. It doesn't reflect.

Comment all code and just throw an alert, see if you get that.

 

And if you do, then start uncommenting code in blocks to debug where is the issue.

 

Add comment in if and else blocks and see if any getting executed

-Anurag

saic2
Tera Contributor

Hi @imran rasheed 

 

I uploaded Screenshot follow that uncheck Global and view option will be visible and enter the workspace view name on the view field