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

So is there no way via a URL field in regards to a list?


Abhinay Erra
Giga Sage

Sorry, I don't think there is a way.


So I have changed the way I'm doing this so that I can hopefully acheive the outcome of having the INC12355 as a link to view itself.


So within the business rule above I am now updating a field on the form   (instead of the related list).


The value is there and if you right click and 'open new tab' it opens the url successfully.


Is there a way to remove the HTML editor and make the field so the users can't change the data?


find_real_file.png


Just create a UI policy and make the incident field as read only by adding a UI policy action . This will remove the HTML editor too.


Creating a UI Policy - ServiceNow Wiki


Also, use target attribute and set it   _blank to open the link automatically in a new window. So your url will look something like this


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


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