
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-26-2016 12:11 PM
Hi Can any one help me on this issue,
how to call ui macro from server side script.
thanks,
Rajendra Prasad Darshanam
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2016 04:59 AM
I did some research into this and it looks like using GlideHTTPRequest() can be difficult if the content type is Binary due to issues between Java and JavaScript. I found another post here on Community which suggests using the RESTMessageV2() Class instead. I was successfully able to download Chuck's avatar image using the following (note I used an Incident record as the target for the attachment):
var url = 'https://community.servicenow.com/people/ctomasi/avatar/80.png?a=7252';
var rm = new sn_ws.RESTMessageV2();
rm.setEndpoint(url);
rm.setHttpMethod('get');
rm.saveResponseBodyAsAttachment('incident', 'd71f7935c0a8016700802b64c67c11c6', 'chuck_image.png'); // update target details here
var response = rm.execute();
if(response.getStatusCode()==200) {
// Success!
}
More information is available on the Product Documentation site regarding this function. Note that it is only available from Geneva onwards.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-26-2016 12:17 PM
UI macros are something to be displayed on the screen. The scripts you mentioned are run on the server and do not present any information.
Can you provide some additional details on what you are trying to accomplish? Details (table names, catalog items, etc) are encouraged. Screen shots are always appreciated.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-26-2016 12:25 PM
Thanks Chuck for your quick response,
actually i want to call pure java script code with dom elements in serverside.
so its not possible to write java script with dom elements in server scripts.
by placing the dom elements in ui macro, i want to call it from indirectly.
Thanks,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-26-2016 12:25 PM
Thanks Chuck for your quick response,
actually i want to call pure java script code with dom elements in
serverside.
so its not possible to write java script with dom elements in server
scripts.
by placing the dom elements in ui macro, i want to call it from indirectly.
Thanks,
On Tue, Sep 27, 2016 at 12:48 AM, ctomasi <community-no-reply@servicenow.com

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-26-2016 02:08 PM
Sorry for the confusion... Don't tell me HOW you want to do something (in technical terms)... please tell me WHAT you want to do? What is the business requirement, objective here?
Example: Display an icon with a red color right after the state field on the form when the state is Overdue.