Pass values through URL-Catalog Item

Hemant1
Kilo Expert

Hello Community

@Ankur Bawiskar 

We created an event thorough flow and we are sending userid and email through URL to populate in the form once the manager click on the link ,But it not working 

Mail script

var catalogItemLink = '/com.glideapp.servicecatalog_cat_item_view.do?v=1&sysparm_userEmail=' + current.email + '&sysparm_userName=' + current.user_name;

template.print("<a href='" + catalogItemLink + "'>" + "Click here to raise the request: Link" + "</a>");

Onload Catalog Item

var gURL = new GlideURL();
   gURL.setFromCurrent();
   var userName = gURL.getParam("sysparm_userName");
   var userEmail = gURL.getParam("sysparm_userEmail"); 

    g_form.setValue('userid',userName);
g_form.setValue('address',userEmail);
	
}

It is Not populating the userid and email in catalog item

Continue....Catalog Item Link In Send Email Action in Flow Designer

1 ACCEPTED SOLUTION

Hi,

then you are not able to fetch the url parameters in onLoad catalog client script?

try this

function onLoad(){

	var url = top.location.href;
	var userName = new URLSearchParams(url).get("sysparm_userName");
	var userEmail = new URLSearchParams(url).get("sysparm_userEmail");

	g_form.setValue('userid',userName);
	g_form.setValue('address',userEmail);

}

Regards
Ankur

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

View solution in original post

7 REPLIES 7

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

are you sure the url came fine with the url parameters?

debug that in client script first

Regards
Ankur

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

Hello @Ankur Bawiskar 

The URL is coming 

The manager details is coming in url but we need user as ex john is manager of Nishikant we want nishikant userid and email in form 

find_real_file.png

Hi,

then you are not able to fetch the url parameters in onLoad catalog client script?

try this

function onLoad(){

	var url = top.location.href;
	var userName = new URLSearchParams(url).get("sysparm_userName");
	var userEmail = new URLSearchParams(url).get("sysparm_userEmail");

	g_form.setValue('userid',userName);
	g_form.setValue('address',userEmail);

}

Regards
Ankur

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

Hello @Ankur Bawiskar 

Now i am getting values in Variables but the issue is the manager details is getting updated in userid and email we want user details is updated 

and in notification also manager details is getting in subject and content 

We want below

Subject : onboarding request:username