- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2017 07:38 AM
Hi guys,
I am doing some integration with PagerDuty and getting the On Call Rota using API. I would like to display the retrieved value on the form via a UI Macro.
Looking at the logs, I know the script include is being called and value being returned, however I am unable to display it on the form. This is what I have so far. Could you please let me know what am I missing? I haven't done any jelly scripting before so I find it challenging.
<tr>
<td>On Call Manager</td>
<g2:evaluate var="jvar_your_var" jelly="true">
var your_var= BFPagerDuty_RetrieveOnCallRotaMgr.retrieveOnCallRotaMgr();
<p>$[jvar_your_var]</p>
</g2:evaluate>
</tr>
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2017 08:30 AM
What is the API you are calling? What is the name of the Script Include and method? From your script I don't see where you instantiate an object of the Script Include class. If I knew the API you are talking about I would know exactly what script you need but I would expect something like this should do the trick:
<tr>
<td>On Call Manager</td>
<g2:evaluate var="jvar_your_var" jelly="true">
var BFPagerDuty_RetrieveOnCallRotaMgr = new BFPagerDuty();
BFPagerDuty_RetrieveOnCallRotaMgr.retrieveOnCallRotaMgr();
</g2:evaluate>
<p>$[jvar_your_var]</p>
</tr>
You might want to review these free trainings about Script Includes and Jelly:
TechNow Episode 1 | ServiceNow Jelly Scripting Part 1 of 3 - YouTube
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2017 08:30 AM
What is the API you are calling? What is the name of the Script Include and method? From your script I don't see where you instantiate an object of the Script Include class. If I knew the API you are talking about I would know exactly what script you need but I would expect something like this should do the trick:
<tr>
<td>On Call Manager</td>
<g2:evaluate var="jvar_your_var" jelly="true">
var BFPagerDuty_RetrieveOnCallRotaMgr = new BFPagerDuty();
BFPagerDuty_RetrieveOnCallRotaMgr.retrieveOnCallRotaMgr();
</g2:evaluate>
<p>$[jvar_your_var]</p>
</tr>
You might want to review these free trainings about Script Includes and Jelly:
TechNow Episode 1 | ServiceNow Jelly Scripting Part 1 of 3 - YouTube
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2017 08:10 AM
Thanks Balaji, it's coming back as blank on the form.
here's what I get in the log, so i know for sure there is a returned value..
03-05-2017 16:07:26
bautistar_admin Information onCallMgr=John Cha
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2017 08:15 AM
Try this way then,
<tr>
<td>On Call Manager</td>
<g2:evaluate var="jvar_your_var" jelly="true">
var your_var= BFPagerDuty_RetrieveOnCallRotaMgr.retrieveOnCallRotaMgr();
your_var
</g2:evaluate>
<p>$[jvar_your_var]</p>
</tr>
or
<tr>
<td>On Call Manager</td>
<g2:evaluate var="jvar_your_var" jelly="true">
var your_var= BFPagerDuty_RetrieveOnCallRotaMgr.retrieveOnCallRotaMgr();
your_var
</g2:evaluate>
<script>
$[jvar_your_var];
</script>
</tr>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2017 08:22 AM
thanks balaji..but no luck!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2017 08:58 AM
Hi Matthew that did the trick. I have to instantiate the script include first before calling the function. Thanks for your help!