How to leave 1st If-block and jump into another 2nd if-block after 2 secns
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2024 03:48 PM - edited 05-20-2024 04:45 PM
hi All,
We have 5-if blocks
each If block has 50-lines of code
if(block 1)
{
50 lines
}
if(block 2)
{
50 lines
}
if(block 3)
{
50 lines
}....
..
etc
if block 1 would not be executed with in 2-sec, break block 1 loop, directly jump into block2 to execute block 2 code ,
if block 2 would not be executed with in 2-sec, break block 2 loop, directly jump into block 3 to execute block 3 code....etc. like this ... till end.
is this kind of behavior achievable?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2024 05:07 PM
Hi, can you clarify your business requirements\drivers for this behavior?
If it was code for a single thread micro-controller then yes it would be understandable, but within the context of ServiceNow I would ensure the design\build did not require this sort of policing/management.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2024 05:51 PM
We have this type code behaviour in 3 places
1. service portal widget server code
2. Scheduled job
3. Business rule
Concept : Here each if-block taking huge time to execute , so plan is If code not executed with in defined seconds, we would like to send generic data at final.
please let me know if you need any details on this. Let me know does it achievable or not.
I tried set interval, set timeout, clear interval but nothing worked.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2024 06:50 PM
Hi, possibly achievable if your 50 lines of code is some sort of loop, but I think that if it's necessary then you have underlying issues that should be reviewed and resolved, and would not recommend this as a best practice approach for anything ServiceNow related.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2024 09:00 PM
I agree this is not best practice.
We want to apply that purposefully if it achievable please let me know syntax for it.