ITSM interview Question asked

SandeepKSingh
Kilo Sage

Q :- How to show inactive incidents to only ITIL admins and hide for all other users, explain different ways to achieve this?

Q:- In workflow, We have run script activity which takes around 10 minutes to execute therefore workflow throws an error as 'Transaction Cancelled : Max execution time exceeded'. Why this issue occurs and how to resolve it?

3 ACCEPTED SOLUTIONS

Sohail Khilji
Kilo Patron
Kilo Patron

HI @SandeepKSingh ,

 

Q :- How to show inactive incidents to only ITIL admins and hide for all other users, explain different ways to achieve this?

 

To do this you can take two approches either you can Query business rule which is recommended approch or you can go for ACL on incident table based on condition and role.

 

Q:- In workflow, We have run script activity which takes around 10 minutes to execute therefore workflow throws an error as 'Transaction Cancelled : Max execution time exceeded'. Why this issue occurs and how to resolve it?

 

depends on the script why it takes 10mins to evecute which is really back, assuming its a REST call the action will be as below.

 

To fix this issue, we would need to adjust the “Maximum Duration (seconds)” of the Transaction Quota Rules related to the type of request.


To adjust these values please navigate to System Definition > Transaction Quota Rules. Since this is an inbound REST transaction, one of the below Transaction Quota Rule will need to be modified depending on the type of REST API:

REST Import Set API request timeout
Prevents inbound REST Import Set API transactions from running for longer than 60 seconds.

REST Table API request timeout
Prevents inbound REST Table API transactions from running for longer than 60 seconds.

REST Aggregate API request timeout
Prevents inbound REST Aggregate API transactions from running for longer than 60 seconds.

REST Attachment API request timeout
Prevents inbound REST Import Set API transactions from running for longer than 60 seconds.


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect

View solution in original post

Anand Kumar P
Giga Patron
Giga Patron

Hi @SandeepKSingh ,

 

1) 

Create a Read ACL for Inactive Incidents:

Table: incident , Operation: read , Condition: Active is false , Roles: Include only the itil_admin role

 

2)Create a Before Query Business Rule:

Table: incident

Script:

if (!gs.hasRole('itil_admin')) {

    current.addQuery('active', true);

}


Workflow transaction cancelled:

The 1-second timer didn’t pause the workflow properly due to system load or timing issues. As a result, subsequent activities continued to run in the user session instead of transitioning to a system worker thread, causing the “maximum execution time exceeded” error.

 

Resolution:

Increase the timer duration to at least 3 seconds. This ensures the workflow properly pauses and resumes in the scheduled worker context, preventing long-running activities from exceeding transaction quotas.

a refer below link 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0855454

 

 

View solution in original post

Ravi Gaurav
Giga Sage
Giga Sage

Hi @SandeepKSingh 

There are two approaches to implement this scenario :

Method 1 : Using ACL

- Write Table.None ACL on incident table to allow only ITIL admin to see inactive incident as below :

RaviGaurav_0-1734522462993.png

Method 2 : Using Before Query BR

- Write before query BR as shown below, it checks if logged in user has ITIL admin role or not. If user has ITIL admin role then inactive incident will be shown otherwise it will be hidden.

BR Configuration :

RaviGaurav_1-1734522496107.png



Ans 2 :- There is transaction Qouta limit set in instance. If any transaction exceeds this limit then it gets cancelled. Generally it is set between 2 to 5mins so if we want our scenario to work then we can increase this value.

However increasing this value is not best practice or may create perormance impact, so rather you can plan to run such heavy long running scripts in background. To do so, we can write such scripts in Script Actions ( Script Actions runs asynchronously in the background ) and call them via workflow run script activity. This way workflow will trigger script in background and move ahead with next activities.

--------------------------------------------------------------------------------------------------------------------------


If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!

Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI

 YouTube: https://www.youtube.com/@learnservicenowwithravi
 LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/

View solution in original post

5 REPLIES 5

SN_Learn
Kilo Patron
Kilo Patron

Hi @SandeepKSingh ,

 

1. This could be achieved via query business rule, you can refer to OOB business rule
https://[instance_name].service-now.com/sys_script.do?sys_id=2bc2f9b1c0a801640199f9eb0067326e&syspar...

 

OR


Using read ACL [incident.None] giving the required role and filter.

 

2. It is already answered here: https://www.servicenow.com/community/developer-forum/run-script-issue/td-p/3032183 

 

----------------------------------------------------------------
Mark this as Helpful / Accept the Solution if this helps.

Sohail Khilji
Kilo Patron
Kilo Patron

HI @SandeepKSingh ,

 

Q :- How to show inactive incidents to only ITIL admins and hide for all other users, explain different ways to achieve this?

 

To do this you can take two approches either you can Query business rule which is recommended approch or you can go for ACL on incident table based on condition and role.

 

Q:- In workflow, We have run script activity which takes around 10 minutes to execute therefore workflow throws an error as 'Transaction Cancelled : Max execution time exceeded'. Why this issue occurs and how to resolve it?

 

depends on the script why it takes 10mins to evecute which is really back, assuming its a REST call the action will be as below.

 

To fix this issue, we would need to adjust the “Maximum Duration (seconds)” of the Transaction Quota Rules related to the type of request.


To adjust these values please navigate to System Definition > Transaction Quota Rules. Since this is an inbound REST transaction, one of the below Transaction Quota Rule will need to be modified depending on the type of REST API:

REST Import Set API request timeout
Prevents inbound REST Import Set API transactions from running for longer than 60 seconds.

REST Table API request timeout
Prevents inbound REST Table API transactions from running for longer than 60 seconds.

REST Aggregate API request timeout
Prevents inbound REST Aggregate API transactions from running for longer than 60 seconds.

REST Attachment API request timeout
Prevents inbound REST Import Set API transactions from running for longer than 60 seconds.


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect

Runjay Patel
Giga Sage

Hi @SandeepKSingh ,

 

Q1 : You can achieve this using

  1. display query business rule: you can do script like

 

if (!gs.hasRole('itil_admin')) {
             current.addEncodedQuery('active=true');
    }

 

  • Using ACL.
  • RunjayPatel_0-1734510466182.png

     

Q2: There is a transaction quota limit set in the instance, which cancels any transaction that exceeds this limit. This limit is typically set between 2 to 5 minutes. To ensure our scenario works as expected, you can increase this time limit but that is not recommended.

you can check it here.

RunjayPatel_1-1734510651678.png

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

 

 

 

Anand Kumar P
Giga Patron
Giga Patron

Hi @SandeepKSingh ,

 

1) 

Create a Read ACL for Inactive Incidents:

Table: incident , Operation: read , Condition: Active is false , Roles: Include only the itil_admin role

 

2)Create a Before Query Business Rule:

Table: incident

Script:

if (!gs.hasRole('itil_admin')) {

    current.addQuery('active', true);

}


Workflow transaction cancelled:

The 1-second timer didn’t pause the workflow properly due to system load or timing issues. As a result, subsequent activities continued to run in the user session instead of transitioning to a system worker thread, causing the “maximum execution time exceeded” error.

 

Resolution:

Increase the timer duration to at least 3 seconds. This ensures the workflow properly pauses and resumes in the scheduled worker context, preventing long-running activities from exceeding transaction quotas.

a refer below link 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0855454