The script can be added via Helpdesk Rebranding - Customize Custom Portal - Layout & Pages - Portal Pages - New Ticket.
Field ID's (#****) in the script have to be adjusted to your own environment. For the Dropdown menus on the portal, you can find the field ID's in the <Select section of the page source. If you need help with this, I can provide some page source examples where to find them.
Hope this helps. I'm looking forward for your result.
Kind regards,
Rutger Bockholts
Freshworks
@Rutger Bockholts
Thanks , you are right it should be &, something was wrong when I wrote the URL but couldn’t put my finger on what is was.
Did some smal Tests and it worked great, going to post some more when I have a full setup.
//Daniel
Could you also populate a dependet field?
And how do you handle field with spaces in them?
Could you also populate a dependet field?
And how do you handle field with spaces in them?
Hi Anders,
A dependent field is possible as well. In below script lines I take the Category field as an example.
Be aware that the main Category value behind the # is a numbered ID, however the sub-category and item-category are both named ID's. In your case, you only have to replace the category ID and the values into a static value or use a variable as showed in my previous post.
As you can see, the spaces for the item category field are notes with “%20”, which is the html code for a space. The script below will do a check in the item category part for this space and replace the “%20” code with an actual space.
When someone is loading the incident form without above url, you don't want additional errors in the console, so I've added an check if the char “&” exist in the url. If not, the rest of the script will be skipped.
<script> jQuery(document).on('PageUpdate', function() { var current_url = window.location.href.toString(); if(current_url.includes("&")) {
// Sub Category: var url_subcategory = getParameterByName('sub_category'); console.log('url sub category: ' + url_subcategory); $("#sub_category").val(url_subcategory).show().trigger("change");
Sorry to re-open an old thread. I am hoping you can provide some assistance please? I think I have found the ID’s in the page source, but I’m not sure where I need to setup the script within Fresh