- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2025 05:22 PM
Hello All,
I have a record producer targetted to entity table, I have a control record referencing that entity. I was able to display the variable formatter on the entity table seamlessly using the same approach of creating a formatter and a macro and adding it to the form layout of the entity form as we do it in incident variable editor.
But i am not able to identify why its not working in the control table, if i wanted to add it, i had made necessary changes and here is my 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">
<g:requires name="scripts/js_includes_catalog.js" includes="true"/>
<g:requires name="styles/${new CatalogCssSelector().getVariableCss()}" includes="true"/>
<g:if_polaris>
<g:then>
<g:requires name="styles/${new CatalogCssSelector().getPolarisVariableCss()}" includes="true"/>
</g:then>
</g:if_polaris>
<g2:evaluate var="jvar_catalog_item">
function eval_cat_item() {
var cat_item = "";
var catItemProducedGr = new GlideRecord("sc_item_produced_record");
catItemProducedGr.addQuery("record_key", current.getValue('profile'));
catItemProducedGr.query();
gs.info("test:"+catItemProducedGr.getRowCount(),"macrotest");
if (catItemProducedGr.next())
cat_item = catItemProducedGr.getValue("producer");
return cat_item;
}
eval_cat_item();
</g2:evaluate>
<g2:evaluate var="jvar_questionset_read_only" jelly="true">
(gs.getProperty('glide.sc.evaluate.variables.write.access', true) == 'true') ? !current.variables.canWrite() : !current.canWrite();
</g2:evaluate>
<div data-sn-macro-sys-id="${jvar_macro_sys_id}">
<g2:evaluate jelly="true"> var recordObject = new GlideRecord('sn_grc_profile');
recordObject.get(current.profile);
</g2:evaluate>
<j2:set var="ref" value="recordObject" />
<j:set var="jvar_producer_target_record" value="true"/>
<g2:client_script type="catalog_item" catalogItem="$[jvar_catalog_item]"/>
<g:inline template="catalog_ui_policy.xml"/>
<g2:render_component componentName="com.glideapp.servicecatalog.DefaultQuestionEditor"/>
</div>
</j:jelly>
Could some one let me know if there is an issue in this
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2025 12:44 AM
Hey @Ankur Bawiskar Thanks for taking your time in assisting here. Got it fixed, after creating the Macro in global scope and formatter in the proper target scope with some existing community info as well from other question. The issue is closed now.
This article did help to some extent in bringing this to resolution if someone is looking for the same in future.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2025 09:00 PM
I doubt this can be achieved.
you created new UI macro for this and used that in formatter?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2025 09:03 PM
Yes , i did..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2025 09:37 PM
are you able to see the variable editor itself?
That's the 1st question.
If yes then next is why it's not bringing the data for referenced record
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2025 09:39 PM
Not seeing the variable editor itself. which is weird , something seems to be broken.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2025 10:04 PM
try this if your Entity table is task extended
catItemProducedGr.addQuery("task", current.getValue('profile'));
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader