In flow designer script is not working

chandan86patra
Tera Contributor

Hi All , 

 

I have written the flow designer script in that whenever any select the incident number it should the incident form in the new page , the script is not working and it is coming in new one link ( url in the output ), could you please correct the flow designer script.

var incidentSysId = fd_data.trigger.current.sys_id.toString();
var incidentNumber = fd_data.trigger.current.number.toString();

 

var baseUrl = gs.getProperty('glide.servlet.uri');

 

var link = baseUrl + 'incident.do?sys_id=' + incidentSysId;

 

return '<a href="' + link + '" target="_blank">' +
       incidentNumber +
       '</a>';

thanks ,

 

4 REPLIES 4

Ankur Bawiskar
Tera Patron

@chandan86patra 

where are you storing this? in which field?

screenshots please

glideFather
Tera Patron

ahoy @chandan86patra,

 

what is the actual requirement? Why do you need the incident number? Could you possibly explain what is this expected to do?

 

Also, what is the flow trigger and where is the script executed? Is there any condition or if statement?

 

When you say "not working", is it triggered but not executed or not triggered at all, could you explain how it is not working? 

 

What could help would be "when I do ___, I expect __ to happen, but instead it is ____", something like this,

Tarun Rekandar
Mega Guru

Hi @chandan86patra ,

 

Your script looks correct. The issue may depend on where you're using it in ServiceNow.

 

Could you please share the story details and a screenshot of the error? This will help me understand the issue and provide a more accurate solution.

 

Regards,

Tarun

yashkamde
Giga Sage

Hello @chandan86patra ,

 

try this, might be the issue is HTML tags are rendering as plain text

var incidentSysId = fd_data.trigger.current.sys_id.toString();
var incidentNumber = fd_data.trigger.current.number.toString();
var baseUrl = gs.getProperty('glide.servlet.uri');
var link = baseUrl + 'nav_to.do?uri=incident.do?sys_id=' + incidentSysId;

// Wrapping with [code] tags tells ServiceNow to render this as HTML
return '[code]<a href="' + link + '" target="_blank">' + incidentNumber + '</a>[/code]';

 
Also ensure that where are you trying to display this link Email, Work Notes, Field(might display raw code).

 

If my response helped mark as helpful and accept the solution.