Can not set display to false client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2016 06:44 PM
I have a field on my sc_req_item table. I am displaying this field on a catalog task. I am trying to hide this field with certain tasks and show with others. I am using this as my script:
g_form.setDisplay('sc_task.request_item.u_choose_a_pc', false);
This line is not working, maybe because of the dot walking? I have used this hundreds of times, but not in this case where I am hiding it from dot walking.
I am using this line in the same script and it works fine, also not dot walking with this one:
g_form.setDisplay('u_stockroom', true);
Can anyone tell me why the first scenario is not working and how I can achieve this in a client script?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2016 07:24 PM
Dot walking is not supported by client side script. so it is not working in first case.
If you are hiding the Variables on TASK, YOU can write a catalog client script on that item and click on applicable on TASK only.
If you are hiding RITM field value, You can create a UI policy on TASK.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-10-2016 01:34 PM
Deep K is right, you can't dot.walk in a client script, that is server side functionality.
I would suggest that you use an Ajax call to get the information you need from the server (Script Include) if the requirement is for an onChange field.
Otherwise I would recommend using a display business rule to put the necessary information on the g_scratchpad to be readily accessible in your client script.
Examples of asynchronous GlideAjax
Kind Regards,
Stefan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2016 08:36 PM
Make sure the field is not made mandatory in a UI Policy or Client Script somewhere else.
Mandatory is mutually exclusive with display false.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2016 10:40 PM
Can you try using this?
g_form.setDisplay('request_item.u_choose_a_pc', false);