- 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:13 AM
No, this is the only way to do this as GlideSystem is not available on client side.
Your business rule has to be of type "display":
http://wiki.servicenow.com/index.php?title=Business_Rules
Did you try to set up the business rule with no condition and also having a gs.log("business rule was triggered") statement?
When that works, try to send an alert() popup to make sure you get it on client side.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2014 06:30 AM
Thanks for your reply.
My business rule did not have any conditions, and when set to type 'display', your suggested log message only appears when viewing the form of the Configuration Item, not from the list view. It's the latter I need help with please.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2014 06:42 AM
ok not sure how to do that on a client side; HOWEVER... what you can do is call server side script from a client side UI action
put in all the code for client side... then add the line
gsftSubmit(null, g_form.getFormElement(), 'd4f4a47251b2c5003750311abc29a08c');
substitute the SID in that statement with the sid for the ui action... then below it put in the server side script...
the UI action should then run everything before that statement client side.. and everything after it server side.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2014 06:48 AM
Not sure that will help me.
What I am actually trying to do from my client script is call window.open() to launch a new window to a 3rd party URL, but I want the actual URL to come from the system property.
I don't think a server-side script will allow that.