restrict the task state based on assigned to field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2024 07:46 AM
we are making task state editable on below conditions only on top of we need add assigned to is current logged in user then only can edit the state field
action:
tried wit run script in true section not working and assigned to dynamic (me) as well
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2024 07:52 AM
current object works in server side but you are using UI policy
So update as this
if (g_form.getValue('assigned_to') == g_user.userID) {
g_form.setReadOnly('state', false); // Make editable
} else {
g_form.setReadOnly('state', true); // Make read-only
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2024 08:37 PM
have tried but still Not working not sure where is UI policy conflict, can you please help me out. Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2024 07:58 AM
@vinnus You are mixing client and server side code here. current.assigned_to should be replaced with g_form.getValue('assigned_to')==g_user.userID;