Auto populate catalog record producer

JJG
Kilo Guru

Hello,

I have a UI action on a record that redirects to a catalog record producer (Pics below). I would like the values to auto-populate on the record producer, what would this code look like? Do I need to pass the values with the UI action? I'm kind of lost here, any help is appreciated. 

find_real_file.png

find_real_file.png

 

1 ACCEPTED SOLUTION

Mark Roethof
Tera Patron
Tera Patron

Hi there,

This is about a Record Producer opened within the Service Portal, correct?

Don't have a really nice suggestion from the top of my mind. Though this works:

find_real_file.png

Obviously, you could pass the candidate sys_id for example in the url. And with GlideAjax retrieve other values you are after.
If not familiar with GlideAjax, see this article I published earlier this week: Client Side Scripting: Go for GlideAjax (with getXMLAnswer)!

So how did the addInfoMessage with the value from the URL got populated? I've just set up a quick and dirty onLoad Catalog Client Script:

function onLoad() {

	var x = top.location.href.split('&candidate=');
	g_form.addInfoMessage('==> ' + x[1]);

}

I do think this could be done better, just don't have an idea myself and this though is a way.

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

View solution in original post

6 REPLIES 6

Mark Roethof
Tera Patron
Tera Patron

Hi there,

This is about a Record Producer opened within the Service Portal, correct?

Don't have a really nice suggestion from the top of my mind. Though this works:

find_real_file.png

Obviously, you could pass the candidate sys_id for example in the url. And with GlideAjax retrieve other values you are after.
If not familiar with GlideAjax, see this article I published earlier this week: Client Side Scripting: Go for GlideAjax (with getXMLAnswer)!

So how did the addInfoMessage with the value from the URL got populated? I've just set up a quick and dirty onLoad Catalog Client Script:

function onLoad() {

	var x = top.location.href.split('&candidate=');
	g_form.addInfoMessage('==> ' + x[1]);

}

I do think this could be done better, just don't have an idea myself and this though is a way.

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Thanks Mark, your solution worked to solve my issue of passing values from a UI Action to a record producer in Service Portal. 

rajneeshbaranwa
Giga Guru

You should pass only sys_id of this record to URL parameter as mentioned here , write a script include to get the required field values using sys_id as input.

You should call this script include in onload() client script and populate fields in record producer.

Harshal Gawali
Giga Guru

Hello,

It's possible, if you pass the values in the URL for the record producer as query parameters, and apply them in an onLoad script:

also refer below links It will help you.

How do you link to a record producer and pass some of the parameters in the url?

Is there a way to read URL parameters in Record Producer script?

 

Regards,

Harshal.