Hide Access Risk SOW when change state is not new
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi All,
We have a requirement ,where I want to show the risk assessment button when change is in new state,user should not be able to change the risk assessment in other states.So I added a condition in risk assessment UI action that change.state==-5,and it is working as expected in native UI.But in Workspace I am able to see the Access Risk button even when the change state is not new and from there I can edit the Risk Assessment.How to make it read-only or hide in workspace view.
Thanks in Advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi Shruti,
I tried the above steps ,but still access risk is visible when change state is other then new.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
share your script here
Did you verify what came in state value and are you comparing correct value?
try this once
function evaluateProperty({
api,
helpers
}) {
gs.info('my value->' + api.data.record_information_change.output.change_request.state.value);
if (api.data.record_information_change.output.change_request.state.value.toString() != '-5') {
return true;
} else
return api.state.riskActions.showRiskAssessment.hide;
}
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Ankur Bawiskar ,
Hi Shruti,
I checked in console,for access state I am getting value as -4 and returning true,but still it is not hiding.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Add a log in the script and check the value in console. Make sure the variant order is lowest and variant is active
console.log("State value" + api.data.record_information_change.output.change_request.state.value);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi Shruti,
I checked in console,for access state I am getting value as -4 and returning true,but still it is not hiding.
