Make few variables editable on sctask
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Hi everyone,
I have created a Catalog Item that successfully generates a Request Item (RITM) and a Catalog Task (SCTASK) upon submission.
The requirement is to make specific variables editable on the SCTASK form, whereas they should remain read-only by default. To achieve this, I implemented a combination of a Display Business Rule (to pass data via g_scratchpad) and an onLoad Client Script to toggle the field permissions.
This solution works perfectly for System Administrators (the variables are editable). However, when I impersonate a standard user from the assignment group assigned to that task, all the variables remain strictly read-only.
Has anyone encountered this issue before, or can you point me toward what might be blocking this?
Thanks!
CC: @Ankur Bawiskar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hey @Advaitk,
Create ACL
| Type | record |
| Operation | write |
| Name | sc_item_variables_task |
| Condition | gs.getUser().isMemberOf('Your Assignment Group Name') |
No role needed. The condition handles it.
Use Your Existing Script with Small Fix
Display Business Rule (on sc_task):
g_scratchpad.canEdit = gs.getUser().isMemberOf('Your Assignment Group Name');onLoad Client Script (System UI > Client Scripts - NOT Catalog Client Script):
function onLoad() { if (g_scratchpad.canEdit) { g_form.setReadOnly('variables.your_variable_name', false); g_form.setReadOnly('variables.another_variable', false); } }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi Thanks for the response.
Tried your solution but still not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago - last edited 2 hours ago
Hi @Advaitk ,
You can an onLoad Catalog Client Script that applies to Catalog Tasks.
function onLoad() { if (g_user.hasRole('admin')) {
g_form.setReadOnly('variables.your_variable_name', false); //Make the variable editable } else { // Make it read-only for non-admins
g_form.setReadOnly('variables.your_variable_name', true); } }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
It is already editable for admin. We want for other users also.
I am facing this issue for this catalog item only. For others same type of BR and client script working fine.
Thanks for the response!
