I AM UNABLE TO SAVE THE BELOW CODE DUE RED LINE ERROR
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2025 05:17 AM
I AM UNABLE TO SAVE THE BELOW CODE DUE RED LINE ERROR LET ME KNOW MY MISTAKE

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2025 05:21 AM
@mani55 In your code you are using an else block without having a corresponding If statement. either remove the else block or use an if block to resolve this error.
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2025 05:27 AM
@mani55 Make sure every 'if' block is properly wrapped in curly braces {} and closed it correctly before the else, we can see else is in if condition only it should be after closing the if condition.
if my response helps, please hit helpful and accept as a solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2025 05:28 AM - edited 08-05-2025 05:46 AM
Hi @mani55 ,
You are using else block without any if Block that is the reason you are getting error.
Regards,
Nikhil Bajaj
Regards,
Nikhil Bajaj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2025 05:28 AM
ELSE without an IF will throw an error.
share your complete script here
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader