
- 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-08-2021 10:34 PM
Hi
what about
(function calculatedFieldValue(current) {
return "[code]<a href='incident.do?sys_id=-1%26" +
"sysparm_query=parent=" + current.parent +
"' target='_blank' class='btn btn-default icon-edit'> New </a>[/code]";
})(current);
Kind regards
Maik
If my answer replied your question please mark appropriate response as correct so that the question will appear as resolved for other users who may have a similar question in the future.

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2021 03:58 AM
Hi Maik,
Thank you.
I've modified the calculated value for another application.
(function calculatedFieldValue(current) {
return "[code]<a href='interaction_log.do?sys_id=-1%26" +
"sysparm_query=interaction=" + current.interaction +
"' target='_blank' class='btn btn-default icon-edit'> New </a>[/code]";
})(current);
When I click button, the page loads with "Record not found". The URL shows:
/interaction_log.do?sys_id=-1%26sysparm_query=interaction=undefined
Desmo

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2021 03:56 PM
I found the issue:
sys_id=-1%26sysparm_query - Produces "Record not found"
sys_id=-1&sysparm_query - Produces a record, however, it affects the link view and disables the hyperlink [no clickable].