How to use client script to hide item in choice list field for list view
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2016 08:10 PM
Hi all,
Do someone know to hide item choice list for list view (not form view) by client script ?
for example, I want to hide "closed" option in field choice list "State"
i use Business rule to solve this : How can remove item of choice list (from the list table, not form)
but it have some problem in some situations.. so decide use client script. But i still don't find any article for the list view.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2016 08:52 PM
Hi The Tran,
Have you tried using the ACL approach as suggested on the post you made reference to? That sounds like the best approach to solve this problem.
Thanks,
Berny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2016 09:06 PM
Perhaps to elaborate,
It's often a best practice to restrict edits on list views because of impacts that it could have in logic which could be running in clients scripts which are not triggered in a list view. Out of the box you will find multiple places within the platform were key fields that change often (like states and substates) are restricted from been modified in a list view.
I know this is perhaps not the answer you wish to hear, but I hope it's helpful.
If i find anything different on this regards, I promise to come back to this post and share it with you.
Thanks,
Berny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2016 09:50 PM
Hi The tran,
Here goes some alternatives I just thought of for what you're trying to accomplish. Keep in mind these are just alternatives, they may not be the best option
Option A) You could remove the option from your list of choices and add it through an On Load script when it's required at the form view.
Option B) You could create an On Cell Edit Client script for the Table / Field. That script will get fired as soon you select the restricted option. You can then alert the user that the option is restricted for XYZ reason and halt the transaction from been submitted by doing a return false;
Thanks,
Berny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2016 01:18 AM
Thanks for your enthusiasm.
with your option A. Because my requirement with Itil role not show "closed". But show "closed " option when user admin login.
so use g_form.addOption(...); not work in list view.