Hide Access Risk SOW when change state is not new

Kaustubh k
Tera Expert

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

4 REPLIES 4

Ankur Bawiskar
Tera Patron

@Kaustubh k 

that must be some other button within UI builder.

Did you identify which one is that?

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Ankur Bawiskar
Tera Patron

@Kaustubh k 

see this link how you can hide that button, in that only you can add logic based on state

Hide "Assess Risk" Button on SOW change form. 

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Ankur Bawiskar
Tera Patron

@Kaustubh k 

Steps (ensure you are in scope "Change Management for Service Operations Workspace")

-> go to this URL

https://instanceName.service-now.com/now/builder/ui/edit/pc/728ec88c43fa2110f20fff53e9b8f278/e934b8dc43032110361dff53e9b8f21c/2e800fb0a700011003396c94d17901fa

-> click Duplicate

Screenshot 2026-02-24 132940.png

 

56.png

-> for the duplicated variant keep order as -10 and Click Save at bottom

56.png

-> Go to risk actions container and select component

56.png

-> then try to see if you can write script in the Hide component.

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Shruti
Giga Sage

Hi @Kaustubh k 

Navigate to Ui builder -> Page collections -> SOW - sidebar tabs top -> Record information -> 

Record Information - Change SNC -> Duplicate variant 
Keep the variant order lowest (10,20)
Go to risk actions container -> complete risk assessment button
Toggle hide component on the right side to add the script
Paste below script to hide component 
/**
 * @param {params} params
 * @param {api} params.api
 * @param {TransformApiHelpers} params.helpers
 */
function evaluateProperty({
    api,
    helpers
}) {

    if (api.data.record_information_change.output.change_request.state.value != '-5') {
        return true;
    } else
        return api.state.riskActions.showRiskAssessment.hide;

}