Executing UI Macro every time page loads

sn_sn_sn
Tera Contributor

I'm trying to pass some parameters by URL between my service catalog and the pages of each catalog item. To ensure this continues smoothly between the two, I was wanting to append such URL parameters to the destination of navigation buttons such as 'Continue Shopping'.

This has ultimately lead to me writing a client-side script in javascript that checks the URL and appends any noteworthy params to navigation buttons if they exist. The problem I'm encountering is that it doesn't seem like the macros' XML is executed every time a page loads, something I've verified by testing with javascript tags at the top of my macro which console.logs and does nothing else. The console logs do not appear in the console every time a Catalog Item page with the macro on it is accessed (even when I can see HTML from the Macro), which leads me to believe some caching or some other control structure is occurring behind the scenes. 

My fundamental questions:

1. In an sc_layouts such as the confusingly named 'Shopping Cart Widget', what lower-level control structure calls these Macros/controls when their XML is invoked?

2. What is the ServiceNow approach to getting some javascript to run every time one of my Catalog Item pages is opened?

0 REPLIES 0