GlideStringUtil.urlEncode exceeding URL char limit - how to fix?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-29-2024 06:29 AM
I have noticed that certain request interactions will become blank if our team attempts to move the interaction to an IT Internal Request. The IT Internal Request from is completely empty despite the interaction having data.
I believe this is tied to the limit of a URL (2048) being exceeded.
I feel like this is OOTB scripting for the Continue UI Action but I'm not sure on the best solution. Please advise.
var interact = new GlideRecord('interaction');
if (interact.get(current.sys_id))
{
current.update();
}
var ctype = current.u_interaction_type;
var contactType = current.type;
var description = current.u_interaction_description;
var shrtdescript = current.short_description;
var customer = current.opened_for;
var reportedBy = current.u_user_reported;
var callBack = current.u_user_callback;
var comments = "Interaction REF# " + current.number + " - ";
var url = '';
var sysID = '';
if (ctype == 'email_spam' || ctype == 'general_inquiry' || ctype == 'email_duplicate')
{
current.state = 'closed_complete';
current.update();
}else if(ctype == 'sc_request')
{
// Add the fields which you want to carry forward
var reqItem = current.u_requested_item;
var requrl = "com.glideapp.servicecatalog_cat_item_view.do?sysparm_id=" + reqItem
+ "&sysparm_requested_for=" + GlideStringUtil.urlEncode(customer)
+ "&sysparm_special_instructions=" + GlideStringUtil.urlEncode(comments)
+ "&sysparm_stack=" + current.getLink()
+ "&sysparm_contact_type=" + contactType
+ "&sysparm_description=" + GlideStringUtil.urlEncode(description)
+ "&sysparm_shrtdescript=" + GlideStringUtil.urlEncode(shrtdescript);
action.setRedirectURL(requrl);
current.isNavigateToCatalog = true;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2024 12:34 AM
Hello @MBarrott ,
The issue you are facing is because of the maximum length allowed for URLs in most web browsers and servers, which is typically around 2,000 characters. You may need to shorten this to resolve the issue.
If you find my response helpful, please consider marking it as the 'Accepted Solution' and giving it a 'Helpful' rating. Your feedback not only supports the community but also encourages me to continue providing valuable assistance.
Regards,
Amitoj