Need to show CR link

Lucky1
Tera Guru

Hello All,

 

In the workflow, after a task completion, I am creating a record in a change request table, 

So, can someone tell me how to navigate the user to the created change request. Because he then goes to the form and clicks on Request approval.

 

 

Regards,

Lucky

1 ACCEPTED SOLUTION

@Lucky1 ,

 

I have already posted in one of my replies 

Steps :

You can remove default value on the URL field

In your create task workflow activity , script section have this logic

var chg = current.getDisplayValue('change_request'); // this will give you the change number
chg = " This CR is created from the"+" "+chg 

//in the URL after u r passing "^u_cmdb_update_from_ctask=yes" add ^short_description=chg
//example url looks below and update the URL field , you can see chg is passed without quotes and its awlays dynamic

current.urlfieldvalue ="/change_request.do?sys_id=-1&sysparm_query=chg_model=007c4001c343101035ae3f52c1d3aeb2^type=normal^short_description="+chg +"^EQ&sysparm_use_polaris=true&sys_target=change_request&sysparm_referring_url=change_request_list.do%3Fsys_id%3D-1%26sys_target%3Dchange_request%26sysparm_fixed_query%3D%26sysparm_group_sort%3D%26sysparm_query%3D%26sysparm_target%3D%26sysparm_view%3D";

 

 

 

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025

View solution in original post

17 REPLIES 17

Hi @Lucky1 ,

 

not sure how you formed this URL, However their is a easy to form the URL you are looking for

Please follow the below steps

1)Go the change request list view

2) click new

 

get the URL (may be after the interceptor) and 

lets say i got this: /change_request.do?sys_id=-1&sysparm_query=chg_model=007c4001c343101035ae3f52c1d3aeb2^type=normal^EQ... 

 

 

so ill just add ^u_cmdb_update_from_ctask=yes right after normal 

 

example : I have set short description as my name in below URL:/change_request.do?sys_id=-1&sysparm_query=chg_model=007c4001c343101035ae3f52c1d3aeb2^type=normal^sh... 

 

Output: when I copy and paste this URL :

HemanthM1_2-1689693758378.png

 

 

 

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025

Thank you Hemanth,

 

It's working.

But one Last request.

As we are creating new Normal change request by clicking the link from Ctask, 

is there a way we can map the current Change request number to a Short description field like, this CR is created from the CHG0012345

 

Sorry and Thank you.

 

 

Regards,

Lucky

Hi @Lucky1 ,

 

 

 

ok, thats simple 

 

in your workflow where your setting the URL, have this simple script 

 

************

Edited: you got to dynamically pass the chg number as below using string concatenation. 

 

 

var chg = current.getDisplayValue('change_request'); // this will give you the change number

chg = " This CR is created from the"+" "+chg 

in the URL after u r passing "^u_cmdb_update_from_ctask=yes" add ^short_description=chg


mine looks like this :

current.urlfieldvalue ="/change_request.do?sys_id=-1&sysparm_query=chg_model=007c4001c343101035ae3f52c1d3aeb2^type=normal^short_description="+chg +"^EQ&sysparm_use_polaris=true&sys_target=change_request&sysparm_referring_url=change_request_list.do%3Fsys_id%3D-1%26sys_target%3Dchange_request%26sysparm_fixed_query%3D%26sysparm_group_sort%3D%26sysparm_query%3D%26sysparm_target%3D%26sysparm_view%3D";

 

 

 

 

 

 

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025

Hi Hemanth,

 

We are not showing the URL from the workflow.

On the Change task there a field of URL type and from there users are clicking the URL and it is redirecting to new Change request.

 

 

Regards,

Lucky

Hi @Lucky1 ,

 

have you hardcoded the URL on the ctask?? (as a default value)

 

if you want to populate change request , you have to dynamically pass CR number

 

I think you have logic in your workflow to create ctask right?? make use of that and set the URL from there (by passing CHG number)

 

on the form bases on the UI policy you can control the visibility of the URL field.

 

 

 

 

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025