Hyperlinks in flow designer
Following are instructions for a custom action to create a hyperlink in Flow Designer. In this case I'm creating a hyperlink to a table record but I'll follow up with a description of a custom action to create an external hyperlink.
The action inputs:
| Label | Type |
|---|---|
| tableName | string |
| recordSysId | string |
| linkDisplayName | string |
The "Generate Link" script:
(function execute(inputs, outputs) { var linkJournal="[code] " + "" + inputs['linkDisplayName'] + "" + " [/code]"; outputs['linkJournal']=linkJournal var linkHTML="" + inputs['linkDisplayName'] + ""; outputs['linkHTML']=linkHTML
})(inputs, outputs);
The action outputs:
| Label | Value |
|---|---|
| linkHTML | step > Generate Link > linkHTML |
| linkJournal | step > Generate Link > linkJournal |
Then when using the action in a flow, drag and drop a lookup record's attributes into the appropriate fields (Incident Table for the first input, Incident Record > Sys ID for the second, then Incident Record > Number for the third input).
The reasoning behind the two outputs is that journal fields require the [code][/code] around the html. (See Formatting within Journal fields using HTML & [code])
For an external hyperlink you only need two inputs, one for the URL and one for the text to display. Then the script is modified to construct the hyperlink appropriately.
I hope you find this helpful.
Daniel
https://www.servicenow.com/community/itsm-articles/hyperlinks-in-flow-designer/ta-p/2301600