- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2015 11:05 AM
We are moving New Calls to Requests and need to include description and short description in the URL that opens up a Request Item. Reserved and unsafe characters are stopping the URL from processing properly. What is the correct way to script the encoding of the URL?
Here is what I've tried. This is from the business rule called "CallTypeChanged to Request"
1. When I try to encode the entire URL I get a message telling me it can't find the page.
var reqFor = current.caller;
var location = current.caller.location;
var reqItem = current.request_item;
var desc = current.description;
var sdesc = current.short_description;
var comments = "NEW_CALL_REF:"+current.sys_id+" "+current.description;
var url = encodeURIComponent('com.glideapp.servicecatalog_cat_item_view.do?sysparm_id=' + reqItem + '&sysparm_user=' + reqFor + '&sysparm_location=' + location + '&sysparm_comments=' + comments + '&sysparm_description=' + desc + '&sysparm_short_description=' + sdesc);
2. When I try to encode portions of the URL, the rest of the URL doesn't transfer properly from the New Call to the Request. The encoded portions do transfer properly. But I need location and requester, and they come over as "undefined". And when I encode them, they still come over to the request item as undefined.
var reqFor = current.caller;
var location = current.caller.location;
var reqItem = current.request_item;
var desc = current.description;
var sdesc = current.short_description;
var comments = "NEW_CALL_REF:"+current.sys_id+" "+current.description;
var url = 'com.glideapp.servicecatalog_cat_item_view.do?sysparm_id=' + reqItem + '&sysparm_user=' + reqFor + '&sysparm_location=' + location + '&sysparm_comments=' + comments + &sysparm_description=' + encodeURIComponent(desc) + '&sysparm_short_description=' + encodeURIComponent(sdesc);
3. When I try to encode the variable data and then place it in the URL, the data doesn't transfer.
var reqFor = current.caller;
var location = current.caller.location;
var reqItem = current.request_item;
var desc = encodeURIComponent(current.description);
var sdesc = encodeURIComponent(current.short_description);
var comments = "NEW_CALL_REF:"+current.sys_id+" "+current.description;
var url ='com.glideapp.servicecatalog_cat_item_view.do?sysparm_id=' + reqItem + '&sysparm_user=' + reqFor + '&sysparm_location=' + location + '&sysparm_comments=' + comments + '&sysparm_description=' + desc + '&sysparm_short_description=' + sdesc;
Any help here would be greatly appreciated.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2015 11:46 PM
This works and the parameter get's passed
gs.setRedirect("com.glideapp.servicecatalog_cat_item_view.do?&sysparm_id=c9e2388a0fe23100781ccf8ce1050e96&sysparm_call_id=" + current.sys_id);
Now read the data from the URL using
decodeURI(document.URL.parseQuery()['sysparm_call_id'])
Use the sys id, query the table and get the call details needed.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2015 11:25 AM
I have a question before answering on the encoding part. Have you considered the size of description field? If I remember, IE can handle only 1024 characters URL. We had used the exact sample approach and burnt our hands.
I would suggest you to just pass the call ticket reference in the URL. In the catalog, read the reference, use a glideajax to query and get the field values of the call ticket.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2015 11:51 AM
Hi Kalai,
I haven't considered that. I've never done a glideajax query, and would need assistance setting it up. Would you help me do that?
I would also like to know the answer to the encoding issue since I am just completely frustrated by it.
Thanks!
Suzanne

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2015 01:01 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2015 11:46 PM
This works and the parameter get's passed
gs.setRedirect("com.glideapp.servicecatalog_cat_item_view.do?&sysparm_id=c9e2388a0fe23100781ccf8ce1050e96&sysparm_call_id=" + current.sys_id);
Now read the data from the URL using
decodeURI(document.URL.parseQuery()['sysparm_call_id'])
Use the sys id, query the table and get the call details needed.