How can I pass the sys_id of a newly submitted record producer (like what happens when sent to generated task)?

scottn
Mega Expert

One of the default redirect options in a record producer is to redirect users to the generated task record (ID=ticket). I want to send users to a different variation of that form but I'm unsure how to derive the Sys_id of the newly submitted record producer. I know I can use this to redirect:

producer.portal_redirect = "sp?id=calscbo_home";

But how do I get the newly created Sys_id into the url? For instance, if I use the default redirect, this is what I'd see in the url:

https://ncsudev.service-now.com/calscbo/?id=ticket&table=x_nocsu_cals_cbo_req&sys_id=0942f047dbf1581...

How do I get that sys_id into the url using [producer.portal_redirect = "sp?id=calscbo_home"] bit of code?

Scott

1 ACCEPTED SOLUTION

The sys_id should be available. So that means you just have a syntax error. Looking at the code you pasted, the " is off.

Try for example:

producer.portal_redirect = "sp?id=cals_cbo_ticket&table=x_nocsu_cals_cbo_req&sys_id="+current.getUniqueValue();

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

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

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

4 REPLIES 4

Mark Roethof
Tera Patron
Tera Patron

Hi there,

This is about using the Record Producer script field, correct? If so, you could just use current.getUniqueValue() or current.sys_id.

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

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

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

Hi Mark,

When I try this, I don't think it knows the current sys_id yet:

producer.portal_redirect = "sp?id=cals_cbo_ticket&table=x_nocsu_cals_cbo_req&sys_id=current.getUniqueValue()";

So all that gets passed is the exact characters in the url, not the value of current.getUniqueValue().

There has to be a way to do it since it works for ID=ticket, I'm just not sure how to get that value into the url so I can use it to pull up the ticket form on my variant page.

Scott

The sys_id should be available. So that means you just have a syntax error. Looking at the code you pasted, the " is off.

Try for example:

producer.portal_redirect = "sp?id=cals_cbo_ticket&table=x_nocsu_cals_cbo_req&sys_id="+current.getUniqueValue();

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

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

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

Hi Mark,

While I'm embarrassed it was something so simple, I greatly appreciate the help. Thank you!

Scott