- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2015 04:51 PM
How do I call my library from a Client Script?
---
gives me an undefined error message.
*The syntax is a little off and I dare not use x as a variable. I am just trying to figure out how to call the SI from the CS.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-23-2015 08:19 PM
Hi Jeremy,
I am not sure how complex your script include is, but remember that you can use a slimmed down GlideRecord object from client scripts.
If you do end up going with GlideAjax, here are some pointers to begin with:
1. Delete the empty initialize function in your script include, as it will break the Abstract Ajax Processor
2. Make sure you include the Object.extendsObject(AbstractAjaxProcessor part of the Script Include, this is what provides the wiring for GlideAjax to work
3. Don't forget to mark the Script Include as Client Callable
4. Use the <GlideAjaxObject>.addParam function in the client script and this.getParameter in the Script Include to pass a variable from client to server.
5. Remember you can only send string parameters from client to server. If you need to send Arrays, Objects or other complex data then you can use JSON.stringify on the client script and new JSON().decode to pass JSON data to the server
6. Likewise, you can use new JSON().encode on the server and JSON.parse on the client to pass JSON data from the server back to the client
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2017 03:15 AM
Create a Script Includes
Use case : Bulk Approve , Provide 'Approve' Button, By clicking on it, go through each 'Expense Report' Record, and approve if 'Expense Report' Record state is 'Submitted'
- Goto 'Script Includes' -> New
- Name as 'ExpenseReportUtil'
- Develop a function called approve(current)
- if(current.state==2){current.state=3;current.update();gs.addInfoMessage('Approved' +current.number);}
Create UI Action in Service Now
Use case : Bulk Approval
- Configure -> UI Actions -> New
- Name as 'Bulk Approve', Choose 'List Bottom of Button'
- Use Script Include which we created in above example
- Create an Object for 'ExpenseReportUtil'
- Invoke 'approve(current)' method of 'ExpenseReportUtil' class.
- Goto 'Expense Reports', you should able to see newly created button 'Bulk Approve' at the bottom of the page.
- Click on 'Bulk approve' , make sure all 'Submitted' state records should change to 'Approved' State.
It is not working.Why?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2019 07:01 AM
hello Jeremy,
Here is a useful documentation explaining all the calling process with all parameters: https://developer.servicenow.com/app.do#!/api_doc?v=jakarta&id=client.
Kind regards
FIKRI BEBNRAHIM Mohamed Jawad