How to set a value on a choice list in the URL with sysparm

mco
Tera Guru

I tried to create a new record from a form with an UI action

I want to pass some parameters to the new form

it works very well with all field excepted for the choice field 'Category'

I tried to set the parameters with the name of the category choice and with the sys_id of the category choice but without success

url += '&sysparm_category=' + 'sys_id';

or 

url += '&sysparm_category=' + 'Incident';

This is the script that I use on my UI action

var url = "name_of_table.do?sys_id=-1";
 url += '&sysparm_category=' + 'Incident';
 url += '&sysparm_date=' + gt.getValue();
 url += '&sysparm_company=' + current.company;
 url += '&sysparm_description=' + current.short_description;
 action.setRedirectURL(url);

could you helping me with this issue ?

Thanks,

Michaël

1 ACCEPTED SOLUTION

mco
Tera Guru

Hello ,

 

I find a solution of my problem , I used &sysparm_query=category=Incident and it works

 

Thanks for your help 😉

View solution in original post

3 REPLIES 3

Mike Allen
Mega Sage

What is the value of Incident?  You don't need the + in that line if it is not a variable, so you can say 

url += '&sysparm_category=Incident';

Check the value.  If it is incident with a lower case, or a number, it may not work.

mco
Tera Guru

Hello Mike,

 

Thaks for your reply , I've removed the + ( thanks for your advise) and I also check the case of the value of the incident selection and it was correct.

Unfortunatly the selectin is not made when the form is created.

Do you have an another idea ? do we have to create something else ?

mco
Tera Guru

Hello ,

 

I find a solution of my problem , I used &sysparm_query=category=Incident and it works

 

Thanks for your help 😉