Ron_DeMedeiros

Using Book Marklets to Debug in Clarity

Discussion created by Ron_DeMedeiros Employee on May 21, 2013
Latest reply on May 25, 2013 by Juan_Ortega
Sometimes the ability to look at the view XML and data XML comes in handy for debugging Clarity. This can be done with the use of bookmarklets. A bookmarklet is a bookmark kept in the web browser that runs JavaScript to add additional browser functionality. When the customer didn't have access to the app log, we setup the bookmarklets and this allowed us to determine what was causing the error. We found the error message text within the xml and determined that the charge code wasn't "Capital" or "Expense".

When an error condition occurs, clicking on the bookmark for the View XML or Data XML from the Clarity page you are on will generate an xml page in the browser. You can save the xml file and then view it with an XML tool



For the View XML:

- Set up a bookmark with a title something like "View XML bookmarklet"

- set the properties of the bookmarklet to:

javascript:(function(){var h=window.location.href;var q=h.indexOf('?');var go=h.indexOf('/go');if(go<0) go=h.indexOf('/nu');var b=h.substring(0,go)+'/app?';if(go<0){window.open(h+'&debug=true');return;}else if(q>=0){b+=h.substring(q+1);}else{var p=h.indexOf('#');if(p>=0)b+=h.substring(p+1);}b=b.replace('#','&');b=b.replace('action:','action=');window.open(b+'&debug=true');})();


For the Data XML:

- Set up a bookmark with a title something like "Data XML bookmarklet"

- set the properties of the bookmarklet to:

javascript:(function(){var h=window.location.href;var q=h.indexOf('?');var go=h.indexOf('/go');if(go<0) go=h.indexOf('/nu');var b=h.substring(0,go)+'/app?';if(go<0){window.open(h+'&debug.data=true');return;}else if(q>=0){b+=h.substring(q+1);}else{var p=h.indexOf('#');if(p>=0)b+=h.substring(p+1);}b=b.replace('#','&');b=b.replace('action:','action=');window.open(b+'&debug.data=true');})();

After the bookmarklets are setup:

1. Recreate issue in Clarity
2. Click on the bookmark for the View XML
3. Save the XML that is showing in the browser window
3. Click on the bookmark for the Data XML
4. Click on the bookmark for the Data XML
5. Save the XML that is showing in the browser window
6. Use a tool such as Notepad++ or XML Spy to view the XML code

Outcomes