- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-06-2015 05:23 AM
I've created a UI Macro (tgr_list_select). I can invoke this macro fine from a UI Page, but I'd actually want to invoke it from a Catalog Item (i.e. associate my UI Macro with a catalog item variable, defined as a UI Macro type). Obviously I can see how to select the UI Macro variable type and reference my macro, but I'm not sure how to pass the necessary arguments to my macro. I suspect that I will create an onLoad catalog client script, but from there, I'd be guessing as to what to do next.
From a UI Page, here is how I invoke my macro:
<g:call function="tgr_list_select"
ls_name='TGR2' ls_select_table='sys_user'
ls_query_table='sys_user_grmember'
ls_query_avail='group.nameLIKEDSW'
ls_query_select='group.nameLIKEDSW^user.nameSTARTSWITHMI'
ls_use_field='user'
ls_size='12'
ls_width='900px'/>
Could someone advise how I would create UI Macro variable within my catalog item such that the item was invoked in a manner like that which I've shown above (as being called from my UI Page).
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-06-2015 10:35 AM
ok, I have an answer. The trick is to create a second UI macro that calls the first UI Macro. Thus, my second UI Macro could then be referenced by the catalog item variable (i.e. defined as a Macro type or a Macro with label type).
One thing that we were NOT able to overcome, however, was that for some reason, the escaped text needed to make the UI Macro work when called from a UI Page will NOT work when invoked from a catalog item. The troublesome line of code is as follows:
#1
for (var i = 0; i ${AMP}lt; options.length; i++)
This escaping is necessary even to merely save the UI Macro.
for (var i = 0; i < options.length; i++)
The above line will not work (i.e. you wont be able to save the UI Macro).
Unfortunately, #1 above will NOT work when called from a Catalog Item. The code gets rendered as
for (var i = 0; i < options.length; i++)
and then bombs.
So, the only way that I could think of to get around that was to have two versions of my UI Macro. One that works for UI Pages (as shown in #1 above), the other coded to work for SC Items as follows:
for (var i = 0; i < options.length; i++)
This version will NOT work for a UI Page, but it will work for a SC Item.
So there you have it.
If anyone finds a better way, please let me know...I'd rather not maintain two versions of this UI Macro.
Ty
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-06-2015 10:35 AM
ok, I have an answer. The trick is to create a second UI macro that calls the first UI Macro. Thus, my second UI Macro could then be referenced by the catalog item variable (i.e. defined as a Macro type or a Macro with label type).
One thing that we were NOT able to overcome, however, was that for some reason, the escaped text needed to make the UI Macro work when called from a UI Page will NOT work when invoked from a catalog item. The troublesome line of code is as follows:
#1
for (var i = 0; i ${AMP}lt; options.length; i++)
This escaping is necessary even to merely save the UI Macro.
for (var i = 0; i < options.length; i++)
The above line will not work (i.e. you wont be able to save the UI Macro).
Unfortunately, #1 above will NOT work when called from a Catalog Item. The code gets rendered as
for (var i = 0; i < options.length; i++)
and then bombs.
So, the only way that I could think of to get around that was to have two versions of my UI Macro. One that works for UI Pages (as shown in #1 above), the other coded to work for SC Items as follows:
for (var i = 0; i < options.length; i++)
This version will NOT work for a UI Page, but it will work for a SC Item.
So there you have it.
If anyone finds a better way, please let me know...I'd rather not maintain two versions of this UI Macro.
Ty
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-06-2015 12:30 PM
Cool