- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-16-2017 09:34 PM
Can anyone please suggest me how to hide a value using business rule.
To be specific When ever the state is other draft and after inserting the problem the draft value in the state field should not be visible.
can anyone please help me on this .
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-16-2017 09:58 PM
Hi Naveen,
For this you need to write an onLoad Client Script. I have checked in my instance against another state and it is working fine. Request you to check the below script and let me know. Find the below screenshot.
If your requirement is to hide the State 'Draft' for any specific view you can mentioned in the 'View' under which the Client Script will run.
I hope this helps.Please mark correct/helpful based on impact
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-16-2017 09:43 PM
Hi Naveen,
Could you please elaborate your requirement, do you want to hide a choice value in state field?
Thanks and regards
Swamy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-16-2017 09:47 PM
yes eactly,
I have 5 value initially when creating a problem
draft,open,pending,closed/resolved.
once we submit the problem with state as open or pending, then the 'draft' value should not be seen .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-16-2017 09:51 PM
Hi Naveen,
This can't be done using Business Rules, you have to use client script (using g_form method) which will work only one forms.
http://wiki.servicenow.com/index.php?title=GlideForm_(g_form)#removeOption
Thanks and regards
Swamy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-16-2017 09:49 PM
I have written the following businesr rule
Onafter Business Rule { Insert}
(function executeRule(current, previous /*null when async*/) {
var ga = new GlideRecord('problem');
var pb = ga.addQuery('state',1);
pb.addOrCondition('state',2);
pb.addOrCondition('state',3);
pb.addOrCondition('state',4);
ga.query();
while(ga.next()){
}
})(current, previous);
i dont know what to write in the code to hide the field. can anyone please suggest.