Set dynamic url in field via a business rule

clyon
Tera Guru

I have a business rule that calls a REST Service to create an Incident in another ServiceNow instance. Upon return I will have the newly created INC and INC sys_id.

I'm trying to set the url to that new INC in the u_incident_number field (type= url) and have the INC number displayed from within a related list.

I able to set the INC number, but the URL goes to the case table which is incorrect. How can I set the URL?

find_real_file.png

find_real_file.png

1 ACCEPTED SOLUTION

use something like this



var url="https://...........?uri=inicdent.do?sys_id="+parsedResponse.result.sys_id;


current.u_incident_number="<a href="+url+">"+parsedResponse.result.number+"</a>";


View solution in original post

14 REPLIES 14

Christina,



For adding display text, you cannot do it using field type of URL. Instead you can use field type of HTML and use this in there


<a href="your url goes here">link text</a>


I changed the field to be type 'HTML' and constructed the href in my business rule as you can see below.



find_real_file.png


As you can see the value of the field is now the href I constructed. What property ? do I set to utilize the href I constructed and to work like an html field?


use something like this



var url="https://...........?uri=inicdent.do?sys_id="+parsedResponse.result.sys_id;


current.u_incident_number="<a href="+url+">"+parsedResponse.result.number+"</a>";


That is much simplier and does create the href value but still in my related list the field   is showing the href value not the INC12345 as a link.



find_real_file.png


Abhinay Erra
Giga Sage

Yes, this only works when you from form. Sorry, it still shows the link when you view from a list