Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

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

11 REPLIES 11

Hi Shruti,

 

I tried the above steps ,but still access risk is visible when change state is other then new.

@Kaustubh k 

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! 🙏

 

 

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

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.

Add a log in the script and check the value in console. Make sure the variant order is lowest and variant is active

function evaluateProperty({
    api,
    helpers
}) {

 console.log("State value" + api.data.record_information_change.output.change_request.state.value);

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

 

}

Hi Shruti,

 

I checked in console,for access state I am getting value as -4 and returning true,but still it is not hiding.