- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2025 02:01 PM
Hello,
when i used background script i am getting multiple rows and at the same time when i used script include i am getting only one value instead of multiple values, and the field i used on the form is a list collector. script as follows:
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2025 12:48 AM
Hello @Kumar147 ,
The problem is at line return chgList.join(',');
this return statement should be out of while loops. In script execution, once return statement read, blocks are automatically terminated. In your script return statement was written in while loops. So, loop terminated at the first iteration, because it reads return statement.
Try the same script with return statement after loops.
Thank you
G Ramana Murthy
ServiceNow Developer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2025 12:48 AM
Hello @Kumar147 ,
The problem is at line return chgList.join(',');
this return statement should be out of while loops. In script execution, once return statement read, blocks are automatically terminated. In your script return statement was written in while loops. So, loop terminated at the first iteration, because it reads return statement.
Try the same script with return statement after loops.
Thank you
G Ramana Murthy
ServiceNow Developer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2025 12:50 AM
how are you calling it?
share the screenshots etc
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