Add a external Script ( Javascript lib )
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2016 07:41 AM
Hey guys ,
am working on constructing a json web token ( JWT) which is uses external javascript lib
<script language="JavaScript" type="text/javascript"
src="http://kjur.github.io/jsrsasign/jsrsasign-4.1.4-all-min.js"></script>
<script language="JavaScript" type="text/javascript" src="json-sans-eval-min.js"></script>
<script language="JavaScript" type="text/javascript" src="jws-3.1.js"></script>
have to include this script in a business rule !! is there a way i can do it ?
Any help is appreciated!
Thank you
Nagendra

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2016 08:02 AM
Business rules run on the server side, so HTML code isn't going to help you there. You'll want to do this in a client script and reference the files with a fully qualified URL if it's not on your system. If you've uploaded the file to ServiceNow using System Definition> Upload file, you'll use the URL it gave you (typically something like jws-3.1.jsdbx, to indicate it came from a database record.)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2016 08:03 AM
This may help: Client Scripts - ServiceNow Wiki
potentially a UI script as well: UI Scripts - ServiceNow Wiki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2017 09:19 PM
Hi Chuck,
I have created an UI page and I want to add javascript library to my html code how can I do.
I went thru above link (UI Scripts - ServiceNow Wiki) but Its giving me an error "Uncaught invalid module definition, module id must be defined and be a string"
Otherwise please let me know for this structure <script>https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.2/jspdf.debug.js "></script> how can I embed this, Is it possible in ServiceNow <script>https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.2/jspdf.debug.js "></script>
UI page code -
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<html>
<head>
<script></script>
</head>
<body>
<div id="content">
<h3>Hello, this is a H3 tag</h3>
<p>a pararaph jjfsafoidaf</p>
</div>
<div id="editor"></div>
<button id="cmd">generate PDF</button>
</body>
</html>
</j:jelly>
Thanks,
Jeet