onLoad catalog client script not running

M_iA
Kilo Sage

I have a simple need to only load a variable set if the logged in user has a specific role. However, for some reason which i cant work out, it doesnt run!

function onLoad() {

    var hasRole = g_user.hasRole('sn_esm_user_admin');
    if (hasRole == true) {
		g_form.setDisplay('query_on_behalf_of', true);
    } else {
		g_form.setDisplay('query_on_behalf_of', false);
    }

}

Have tried all of the individual fields as well, but no luck!

Any ideas?

1 ACCEPTED SOLUTION

M_iA
Kilo Sage

I scrapped the client script completly and went with this on the individual variables within the variable set:

M_iA_0-1724948795690.png

This worked and for people who want no code, this is the solution

View solution in original post

6 REPLIES 6

M_iA
Kilo Sage

I scrapped the client script completly and went with this on the individual variables within the variable set:

M_iA_0-1724948795690.png

This worked and for people who want no code, this is the solution