UI Macro - how to get <g2:evaluate> to work
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2015 11:53 AM
I am working through an issue to embed a workflow stage in a UI Macro. I have hit a roadblock with the call to item_workflow.xml. For some reason none of the g2:evaluate tags on the UI macro seem to evaluate.
The original thread is here: CMS - How to embed a workflow stage list in a table
Trying to call the following code:
<g:inline template="item_workflow.xml" />
Instead of the expected HTML element in the page, I see what I assume is the contents of the xml file eferenced in the <g:inline> statement, which is:
<g2:evaluate expression="'sc_req_item.stage'" var="jvar_ref"></g2:evaluate>
<g2:evaluate expression="sc_req_item.stage.getGlideRecord().sys_id" var="jvar_id"></g2:evaluate>
<g2:evaluate expression="RendererFactory.getRenderer('sc_req_item.stage', '$[jvar_id]')" var="jvar_rend"></g2:evaluate>
<g2:macro_invoke workflow_id="$[jvar_id]" ref="$[jvar_ref]" macro="$[jvar_rend]"></g2:macro_invoke>
As a test, I added the following simple code to the page to see if any g2 tags are gettign evaluated:
<g2:evaluate var="jvar_g2_test">
var test = "test";
test;
</g2:evaluate>
$[jvar_g2_test]
which outputs directly on the page:
Can anyone provide insight as to why these g2 tags do not seem to be getting evaluated?
- Labels:
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2015 09:50 AM
I'm glad you got it worked out.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2015 04:58 AM
Hi Kevin,
Just out of interest you said you need to convert the list block to a dynamic content block, and remove all instances of current.
In your dynamic content block did you use, the standard features:
<g:for_each_record file="${current}" max="jvar_max_entries">
<g:content_summarizer contents="${current}"/>
</g:for_each_record>
If so what do you have to provide as the file variable and the content summarizer variable
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2015 05:23 AM
Warren, see the post linked above: CMS - How to embed a workflow stage list in a table
The solution proposed by ServiceNow was to create a GlideRecord query to fetch the needed data instead of using the current variable, and then to use an undocumented function that pushed the contents of the each iteration of the GlideRecord into the current context for use by the module I needed that depended on g2:evaluate
/> <g2:evaluate expression="sc_req_item.putCurrent();" />