
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2021 07:41 PM
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
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2021 07:06 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2021 12:50 PM
Hi Maik,
Any suggestions on how to display a shortened hyperlink on a list view?
I'm in a catch 22 with using a string field.
- If I use sys_id=-1%26sysparm_query in a string field, it shows the button and opens a new record form, but, it doesn't populate the parent field.
- If I use sys_id=-1&sysparm_query, it disables the use of the [code][/code] and the link is unusable / unclickable.
Appreciate your assistance.
Desmo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2021 07:06 PM
Hi
maybe
sys_id=-1&sysparm_query
helps.
Kind regards
Maik

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2021 02:10 PM
You, sir, are a genius! Thank you!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2021 10:37 PM
Hi,
I guess you are trying to set current record as parent to the new incident being created then make following changes:
(function calculatedFieldValue(current) {
return "[code]<a href='incident.do?sys_id=-1%26sysparm_query=parent="+current.sys_id+"' target='_blank' class='btn btn-default icon-edit'> New </a>[/code]";
})(current);
Thanks,
Anil Lande
Thanks
Anil Lande

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2021 10:14 PM
Hi Anil,
I'm getting "Record not found".
Desmo