Published Report URL - where is it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2011 02:09 PM
Recently I have been working with published reports. I have noticed and become frustrated with the fact that the published report URL only gets displayed immediately after you publish the report. Following that, good luck on finding it somewhere. You have to know the URL string and add a sys_id to the end of it. So here is a simple way of solving this.
I created a URL field on the sys_report table and created a client script to populate it, and display it if it is a published report. Here are the steps.
1. Create a new Field (of type URL)on the sys_report table. I called it "Published URL" (u_published_url).
2. Apply the following client script to the sys_report table.
function onLoad() {
var theroles = gel('sys_report.roles_nonedit');
checkroles = theroles.innerHTML;
if (checkroles.indexOf('public') >= 0) {
var reportid = g_form.getUniqueValue();
var reporturl = "sys_report_display.do?sysparm_report_id=" + reportid;
g_form.setValue('u_published_url',reporturl);
g_form.setDisplay('u_published_url', true);
}
else {
g_form.setDisplay('u_published_url', false);
}
}
Now you may ask, why a client script, and not a business rule?I could have created a business rule, but that would have to run on insert,update, or delete. Which is ok unless you already have a bunch of published reports. You would then have to run a background script to update all existing published reports. Although not that big a deal, I wanted the easiest drop in place method to accomplish this for anyone.
If you look at my screenshot, you will see that the URL is not your entire instance. If you hover over the URL, and refer to the status bar of your browser, you should see your entire instance URL. This is the nature of the URL field.
Good luck, let me know what you think.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2011 03:23 PM
As irony would have it, I just saw that there was a UI action, on List Context menu (Show Published URL). It basically adds an addInfoMessage, similar to yours. I like your use of the ArrayUtil() in the condition.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2011 06:45 AM
In /demo today, there is a new property glide.ui.report.show_published_url that, if true, displays a published report's URL at the top of the page when you run the report.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2011 07:01 AM
This is great. Would love to see the back-end UI action activated and turned into a form link or something. Right now the UI action is turned off, works as a list context menu, and applies to all reports...not just the published ones. Seems like it should be turned on as a form link for just published reports...and it should just do a form refresh instead of navigating away from the record. Probably a 10 minute fix that makes a lot of sense.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2011 07:55 AM
I tried out the property you mentioned. That is a nice, simple improvement. When you run a report, that is published, the published URL appears at the top. The UI Action does also complement the property as well. It allows the URL to be seen, on the form without running the report. As Mark suggested, I added a couple more items to the UI Action to make it more targeted to published reports.
I added the condition (as you had suggested in your previous post). Also the redirect, to stay on the current form.
// The Condition
new ArrayUtil().contains(current.roles.split(","), "public")
// Redirect to stay on same form
action.setRedirectURL(current);
And selected it also as a form link.
The only thing I don't like about this solution, is that the link is not clickable, as in my first example. But all of these are really nice improvements.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2011 08:50 AM
The last things I would do to round this out, would be to create a UI Action to Un-Publish the report, then likewise, if not published have a UI Action to publish it. Really, it is easy to take the public in or out of the role, but to an SNC newbie, this may or may not be understood. So here is the customer intuitive way.
Here is how I did the "Un-Publish Report". Set it as a button. link, whatever.
//Condition
new ArrayUtil().contains(current.roles.split(","), "public")
//Script
action.setRedirectURL(current);
var theroles = current.roles;
var arr = theroles.split(",");
var val = 'public';
for(var i=0; i<arr.length; i++) {
if(arr<i> == val) {
arr.splice(i, 1);
current.roles = arr.toString();
current.update();
break;
}
}
Here is the Publish. Again create it as a button, link, whatever.
//condition
new ArrayUtil().indexOf(current.roles.split(","), "public") < 0
//script
action.setRedirectURL(current);
var theroles = current.roles;
current.roles = theroles + "," + "public";
current.update();
Again this is on the Report Administration (report list and forms).