- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2017 07:34 AM
Hi ServiceNow Community,
I would call a Script Include by pressing a button. For exemple:
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<button type="button">Script Include Execution</button>
</j:jelly>
Best Regards,
Davide.
Solved! Go to Solution.
- Labels:
-
Team Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2017 09:01 AM
I've resolved in this way:
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<button type="button" onclick="runCode()">Execution</button>
<script>
function runCode()
{
var ga = new GlideAjax('NewIncludeClient');
ga.addParam('sysparm_name','function1');
ga.getXMLWait();
var result=ga.getAnswer();
alert(result);
}
</script>
</j:jelly>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2017 09:01 AM
I've resolved in this way:
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<button type="button" onclick="runCode()">Execution</button>
<script>
function runCode()
{
var ga = new GlideAjax('NewIncludeClient');
ga.addParam('sysparm_name','function1');
ga.getXMLWait();
var result=ga.getAnswer();
alert(result);
}
</script>
</j:jelly>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2017 11:43 AM
Hi,
I have a script include "BillingUtilAjax" and UI action "popupDispList()". I need to call the script include via the UI action in jelly. I use following code, but it won't work.
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<button type="button" onclick="popupDispList()">Execution</button>
<script>
function popupDispList() {
var ajaxQry = new GlideAjax('BillingUtilAjax');
ajaxQry.addParam('sysparm_name','getHtmlForBillingReport');
ajaxQry.addParam('sysparm_ritm','');
ajaxQry.addParam('sysparm_req', g_scratchpad.requestSysId);
ajaxQry.addParam('sysparm_today',(new Date()).toString());
ajaxQry.getXML(ajaxResponse);
}
function ajaxResponse(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
var win = window.open("", '_blank');
win.document.body.innerHTML = answer;
win.document.title = 'Billing Form';
win.focus();
}
</script>
