Hi, I am new to Snow

chaithraravi
Tera Contributor

Create a before query on the business rule on an incident table, such that users who are having itil role, should see only ACTIVE incidents.

It will be helpful

Thank you

3 REPLIES 3

Peter Bodelier
Giga Sage

Hi @chaithraravi,

 

I would highly discourage that logic.

 

In my experience users often look back to older incidents, to find out how something was solved.

Inactive incidents can be used by problem management to find out trends.

I probably could give you some more reasons, but I think you get the idea. 😉


Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

Amit Gujarathi
Giga Sage
Giga Sage

HI @chaithraravi ,
I trust you are doing great.
You can use below script for the same

(function executeRule(current, previous /*null when async*/) {

    // Check if the user has the 'itil' role
    if (gs.hasRole('itil')) {
        // Add a condition to the query to only show ACTIVE incidents
        current.addQuery('state', '=', '1'); // Assuming '1' is the value for ACTIVE state in your instance
    }

})(current, previous);

Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi



Amit Gujarathi
Giga Sage
Giga Sage

HI @chaithraravi ,
I trust you are doing great.
You can use below script for the same

 

(function executeRule(current, previous /*null when async*/) {

    // Check if the user has the 'itil' role
    if (gs.hasRole('itil')) {
        // Add a condition to the query to only show ACTIVE incidents
        current.addQuery('state', '=', '1'); // Assuming '1' is the value for ACTIVE state in your instance
    }

})(current, previous);

 


Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi