The Zurich release has arrived! Interested in new features and functionalities? Click here for more

I have a requirement to capture value of requested for while redirecting user to another form

sneha_chauhan
Tera Expert

I have a requirement to capture value of requested for while redirecting user to another catalog item form when a specific value is selected in service affected dropdown. Requested for is a reference field which is editable. I am able to redirect to new form using client script but I am not able to pass the value of requested for. Kindly help

1 ACCEPTED SOLUTION

@sneha_chauhan 

you will also need an onLoad client script on the other catalog item to get the value from URL and populate that

Did you add that script?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

6 REPLIES 6

@sneha_chauhan 

you will also need an onLoad client script on the other catalog item to get the value from URL and populate that

Did you add that script?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

sneha_chauhan
Tera Expert

Hi @Ankur Bawiskar 

 

Its working now, thanks for your quick help.

Just one thing, when I am directly opening the other catalog item its showing "There is a JavaScript error in your browser console" because of the onLoad client script, how I can remove that?

 
below is my script:
function onLoad() {
   //Type appropriate comment here, and begin script below
   var myparm = getParameterValue('sysparm_caller_id');
   g_form.setValue('caller_id', myparm);

   function getParameterValue(name) {
        var url = top.location.href;
        var value = new URLSearchParams(url).get(name);
        if (value) {
            return value;
        }
        if (!value) {
            var gUrl = new GlideURL();
            gUrl.setFromCurrent();
            value = gUrl.getParam("sysparm_id");
            return value;
        }
    }
}