Create a Custom Action in Flow Designer to Create a Dynamic Link to the RITM

jmiskey
Kilo Sage

In Flow Designer, it appears that you cannot use the ${URI} parameter to create a dynamic link to the RITM in a Send Email action.  I came across a similar thread, but like with a lot of posts on this site, the links to earlier versions are pretty much dead in all replies more than a year or two old (https://www.servicenow.com/community/developer-forum/how-to-add-link-to-ritm-in-flow-designer-send-m...).

 

I really would like to find out a way to do this using the Send Email action.  The post from Aishwarya_R looks promising, but what I would really like to do is create a reusable Custom Action that I can use that will build the URL needed for the Send Email action.

 

I am thinking that the Custom Action would have the following information:

- inputs: sys of RITM, RITM number

- output: dynamic URL to RITM

And I really do not want to hard-code the environment into the URL.  I would love it to be dynamic, to automatically build in the DEV, TEST, or PRD portion of the URL (instead of having to hard-code it), so it will reflect whatever environment it is being run from.

 

Is this all possible?

 

Thanks

1 ACCEPTED SOLUTION

I found this link you provided to be most helpful, in allowing me to do what I wanted: https://www.servicenow.com/community/developer-forum/link-to-request-number-in-flow-designer-email-n...

 

Here is how I created my Custom Action:

 

Input variables:

jmiskey_0-1713360087669.png

 

Script:

jmiskey_1-1713360129205.pngjmiskey_2-1713360172065.pngjmiskey_3-1713360197796.png

 

Outputs:

jmiskey_4-1713360225569.png

 

The only minor complaint that I have is it returns the entire URL string, instead of the friendly "RITM" number only link.  You cannot use data pills in the URL icon in the Email Editor.  But I can live with that.  However, if anyone knows of a trick to do it, I would love to hear it.

View solution in original post

3 REPLIES 3

James Chun
Kilo Patron

Hi @jmiskey,

 

Is there a reason why you need to use the 'Send Email' action instead of 'Send Notification'?

I think there are a number of limitations to using 'Send Email' such as not being able to use objects such as {URI} you mentioned, and not being able to use email script (not sure on this tho). To me, it looks very static and cannot support various scenarios.

 

In regards to 'not want to hard-code the environment URL', you can use the following script which would return the URL of the current environment:

gs.getProperty('glide.servlet.uri'); //return https://yourinstance.service-now.com/

 

Someone created something similar to your requirement, may worth having a read - https://www.servicenow.com/community/now-platform-articles/flow-designer-record-link-generator/ta-p/...

Or this - https://www.servicenow.com/community/service-management-forum/how-to-get-url-of-a-record-from-flow-d...

 

Cheers

One big advantage to the "Send Email" is that you can just data pills and drag and drop fields from your Catalog Item very easily.  In the spirit of "low code" and our citizen developers and new developers, creating dynamic emails, pulling data from the Catalog Item itself is much easier with "Send Email" than it is in developing a generic notification outside the flow, and then using "Send Notification".

 

I am almost done for the day here, but will dive into those links you provided tomorrow morning.

 

Thanks

I found this link you provided to be most helpful, in allowing me to do what I wanted: https://www.servicenow.com/community/developer-forum/link-to-request-number-in-flow-designer-email-n...

 

Here is how I created my Custom Action:

 

Input variables:

jmiskey_0-1713360087669.png

 

Script:

jmiskey_1-1713360129205.pngjmiskey_2-1713360172065.pngjmiskey_3-1713360197796.png

 

Outputs:

jmiskey_4-1713360225569.png

 

The only minor complaint that I have is it returns the entire URL string, instead of the friendly "RITM" number only link.  You cannot use data pills in the URL icon in the Email Editor.  But I can live with that.  However, if anyone knows of a trick to do it, I would love to hear it.