- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2014 02:38 AM
I have a client-side UI Action for the Configuration Item table that adds a button to the form header and a context menu item to the list. The script needs to access one of my application's properties but I cannot work out how to do this.
I have tried:
var gr = new GlideRecord('sys_properties');
gr1.get("name", "myCat.myProp");
but this returns 'undefined'.
I have created a Business Rule (also for Configuration Item) that pushes the property into g_scratchpad, and while this works when I click the form header button, the script debugger reports g_scratchpad as undefined when I use the list context menu (presumably because the Business Rule has not executed). I have tried setting the rule to execute 'before', 'after' and 'display' with no change.
Is there any better way for me to get the property?
Thanks,
Andrew
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2014 07:03 AM
Best would be to get both values with one AJAX call.
Here is an example how to transport multiple values from server to client using JSON:
/* How to return multiple values via XML:
*
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2014 06:51 AM
Well, in order to get the value of the system property you need to query the sys_properties table.
GlideAjax allows you to do that with a callback function so the experience for your users will be very smooth and fast.
Basically, you trigger the client script, the client script does an AJAX call to the server, in return you get the URL and continue in your script using a callback function to trigger the pop-up window.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2014 07:00 AM
Interesting - that may work for me, but what if I wanted two properties? Would the
first callback have to issue a new AJAX call, and then I do my work in the second callback? If so, I suppose I need to assign the value of the first property to a global jscript variable so I can access it from the second callback.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2014 07:03 AM
Best would be to get both values with one AJAX call.
Here is an example how to transport multiple values from server to client using JSON:
/* How to return multiple values via XML:
*
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2014 08:12 AM
I think you forgot the URL, but I worked it out myself.
thanks everyone for your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2014 08:19 AM
Sorry for that. Seems like my reply email was cut off in the middle of the code.
Let me know if you need the code.