- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2022 02:34 AM
hi all actually i have task , when i upload any attachment in SC task form ,it should also been seen in REQUEST form related to that sc task. i tried below script but its not working .. can anyone tell whats wrong with below script , because am new to this scripting world
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2022 03:10 AM
@SAM321 Tried and Tested solution.
Please add when to run condition as below image
Add the below script:
ServiceNow Community Rising Star, Class of 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-14-2022 04:28 AM
@SAM321 Then keep the filter conditions same and change the script as below
ServiceNow Community Rising Star, Class of 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2022 03:28 AM
@SAM321 Create scheduled job
Go to "System Definition > Scheduled jobs" module
Click on new button
Click on "Automatically run a script of your choosing"
add below code and save
ServiceNow Community Rising Star, Class of 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-16-2022 02:28 AM
@jaheerhattiwale sir actually am not working on any project...its a task given by my team head ..for learning purpose....He said try to do the task in another way
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-16-2022 02:31 AM
Please tell him that it the BR on attachment table will work BTW.
If at all he want it in another way please ask the trigger point. Like when the sc_task is closed then move the attachments to requested item.
ServiceNow Community Rising Star, Class of 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-17-2022 09:20 PM
yes when sc_task is closed attachment should be moved to request.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-17-2022 09:53 PM
@SAM321 Ok got it.
Then create after update business rule on sc_task table and add condition "Active cahnges to false" as shown in image below
Add the below script:
(function executeRule(current, previous /*null when async*/ ) {
GlideSysAttachment.copy("sc_task", current.sys_id.toString(), "sc_request", current.request.toString()); //This line for moving attachments to request
GlideSysAttachment.copy("sc_task", current.sys_id.toString(), "sc_req_item", current.parent.toString()); //This line for moving attachments to requested item
})(current, previous);
Please mark as correct answer if this solves your issue.
ServiceNow Community Rising Star, Class of 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-21-2022 03:11 AM
@jaheerhattiwale sir can we do this task without using business rule?...means in any other way without going to business rule option