- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2017 04:55 AM
Hi All,
I have a UI Macro placed beside reference button of Configuration Item on Incident form. I need to pass the cmdb_ci field's value to the UI page which is being invoked by the UI macro.
PFB script:
UI Macro:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:evaluate var="jvar_guid" expression="gs.generateGUID(this);" />
<j:set var="jvar_n" value="show_task_${jvar_guid}:${ref}"/>
<g:reference_decoration id="${jvar_n}" field="${ref}" onclick="showRelatedCI('${ref}'); " title="${gs.getMessage('Show related CI')}" icon="glyphicon glyphicon-th-list"/>
<script>
function showRelatedCI(ref){
alert(ref);
var val=g_form.getValue(ref);
alert(val);
var dialog = new GlideDialogWindow("add_comments_dialog");
dialog.setPreference('cmdb_ci',val);
dialog.setTitle("Eligibility");
dialog.render();
}
</script>
</j:jelly>
UI Page:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:evaluate var="jvar_gr" jelly="true">
var p="";
gs.log('jellyCheck002----');
var idf = RP.getParameterValue('cmdb_ci'); --------- This is returning the UI Page's sys_id.
var gr = new GlideRecord('incident');
gr.get('sysparm_id','sysparm_id');
var sys = gr.sys_id;
var number = gr.number;
gr.addQuery('number',number);
gr.query();
if(gr.next()){
p=gr.getDisplayValue('cmdb_ci');
gs.log('yht005--'+p);
}
var appt = gr.cmdb_ci;
gs.log('yaa001--'+idf);
gs.log('y002--'+number);
gs.log('y003--'+appt);
gs.log('y004--'+sys);
</g:evaluate>
</j:jelly>
Please suggest.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2017 06:47 AM
Hi Shipra,
Instead of this var idf = RP.getParameterValue('cmdb_ci');
update your code to have this and check now
var idf = RP.getWindowProperties().get('cmdb_ci');
RP.getParameterValue(parameterName) is used for URL and not window.
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2017 06:47 AM
Hi Shipra,
Instead of this var idf = RP.getParameterValue('cmdb_ci');
update your code to have this and check now
var idf = RP.getWindowProperties().get('cmdb_ci');
RP.getParameterValue(parameterName) is used for URL and not window.
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader