- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2015 09:39 AM
Hi ServiceNow Community Developers,
Is there a way to define a scratchpad variable as an array? Basically can you declare a scratchpad variable as an array just like you would with an other field in a script in ServiceNow? Please advise.
Thanks,
Johannes
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2015 10:52 AM
I tested this out in a workflow and it worked fine. So yes, you can!
var test_array = [];
test_array.push('test1');
test_array.push('test2');
workflow.scratchpad.new_array = test_array;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2015 10:37 AM
Don't see why not. You could always do a test run where you set a scratchpad to an array, then gs.log it in the next activity (assuming you're not working in a scoped app)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2015 10:52 AM
I tested this out in a workflow and it worked fine. So yes, you can!
var test_array = [];
test_array.push('test1');
test_array.push('test2');
workflow.scratchpad.new_array = test_array;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2015 10:54 AM
Thanks Guys for your responses