Create record and populate parent field using a URL

Desmo
Mega Guru

Hello,

Use case: Give users a quick and easy way to create a related record using a URL [hyperlink] from a list view. Link to open a form in new tab and populate the parent field.

Solution: 1) I followed and implemented a link according to Article 1. 2) Configured the URL (href) according to Article 2. I created a new string field, added the script in the Calculated Value field, and configured the URL.

(function calculatedFieldValue(current) {
	return "[code]<a href='incident.do?sys_id=-1%26sysparm_query=parent=parent.sys_id' target='_blank' class='btn btn-default icon-edit'> New </a>[/code]"; 
})(current);

The above was successful except I'm struggling to populate the parent field. You'll notice I placed parent.sys_id as a place holder.

 

Thanks to all who respond.

Desmo

1 ACCEPTED SOLUTION

Hi

maybe 

sys_id=-1&amp;sysparm_query

helps.

Kind regards
Maik

View solution in original post

11 REPLIES 11

Anil Lande
Kilo Patron

Hi,

As you have created string field, I don't think it will work with HTML contents.

Instead can you please convert it to URL and make following changes?

find_real_file.png

 

Your calculated field script would be:

(function calculatedFieldValue(current) {
	return "incident.do?sys_id=-1&sysparm_query=parent="+current.sys_id; 
})(current);

 

 

Thanks,

Anil Lande

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

Hi,

Please check this link, here all steps are given:

http://www.john-james-andersen.com/blog/service-now/making-linky-lists-in-servicenow-list-views.html

 

Thanks,

Anil Lande

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande