Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

How long does it take for a UI script change to take effect?

cdgaefke
Kilo Expert

I have a non global UI script that is referenced in a UI Macro by a formatter (maybe it's the other way around) so that I can reference all the routines on my modules without the UI script being global.

 

I'm experiencing very odd timing problems.

 

I'll make a change in my UI script, reload the module, but the changes don't seem to be taking immediate effect.   And I'm not sure exactly how/when to get them to take effect.

 

I typically run with three browsers open:

 

Firefox is my main coding browser.

IE11 is used for my reference, IE, to see something else in SVN while coding in Firefox

Chrome I use for testing functionality

 

Up until now this setup was working fine for me.   I'd make a change in Firefox, save it, reload the module in Chrome and see the changes.

 

Now, however, I'm using the setup above, where a UI script is in a UI Macro that is in a formatter.   And I never know when my code is going to take affect.   I've tried reloading the module, logging out, closing browsers and relogging, pressing Ctrl-F5 to force a refresh, and I'm getting inconsistent results.   Sometimes my code is active, sometimes it isn't.   If I check the code, the changes are there in all the browsers, but it seems as if SVN is using an older version somewhere.   Right now I have a simple alert() in the beginning of my routine, and IE won't show it, but Firefox will.   And my most recent change isn't showing anywhere!

 

Last time this happened I thought I was running into browser compatibility issues, and I went home for the day slightly distressed that I have code that works in one browser and not another.   The next day, without making any changes, it suddenly worked in both browsers!   Now I understand it's the same timing issue I'm seeing now.

 

Any thoughts on this oddness?   It's making coding very difficult, as I never know if I have a typo somewhere or if my code just hasn't taken effect yet.

 

Thanks.

1 ACCEPTED SOLUTION

cdgaefke
Kilo Expert

I ended up opening a ticket on   HI about this.   The devs gave me this code to put in the UI Macro which works beautifully:



<?xml version="1.0" encoding="utf-8" ?>


<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">


          <g2:evaluate var="jvar_stamp">


                  var gr = new GlideRecord('sys_ui_script');


                  gr.orderByDesc('sys_updated_on');


                  gr.query();


                  gr.next();


                  gr.getValue('sys_updated_on');


          </g2:evaluate>


          <g:requires name="YOUR SCRIPT NAME HERE.jsdbx" params="cache=$[jvar_stamp]" />


</j:jelly>


View solution in original post

16 REPLIES 16

Hi Bell,



I am using below script and I am including this ui script from ui page.



<g:evaluate var="jvar_stamp">  


  var gr = new GlideRecord('sys_ui_script');  


  gr.orderByDesc('sys_updated_on');  


  gr.query();  


  gr.next();  


  gr.getValue('sys_updated_on');  


  </g:evaluate>  


<g:requires name="angular.min.jsdbx" params="cache=$[jvar_stamp]"/>


<g:requires name="u_associate_da_bs_stub_js.jsdbx" params="cache=$[jvar_stamp]" />  



Warm regardsm


MIlap


I suggest that you do some troubleshooting and log the results of your query. That code just gets the date of the latest UI Script updated. I have not used that code so I don't know how well it works. Maybe you could try the code that I suggested to see if it works better?