
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2018 02:06 PM
Hello,
I'm working on a custom UI macro to add attachment on a form. How can I get the sys_id of the current record and pass it to the second parameter of the saveAttachment function. The following code doesn't work and I'm not familiar with Jelly Script. Thank you so much for your help.
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<div class="label-text" style ='margin-left: 6%;'>Secure Attachments:
<button onclick="saveAttachment('sn_si_physical_security_incident', gel('sys_uniqueValue').value);" id="header_add_attachment" title="" aria-label="Secure Attachments" class="btn btn-icon icon-paperclip navbar-btn" data-original-title="Secure Attachments">
</button>
</div>
</j:jelly>
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2018 06:41 PM
Hmm, try this with a return false:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<div class="label-text" style ='margin-left: 6%;'>Secure Attachments:
<button onclick="saveAttachment('sn_si_physical_security_incident', g_form.getUniqueValue()); return false;" id="header_add_attachment" title="" aria-label="Secure Attachments" class="btn btn-icon icon-paperclip navbar-btn" data-original-title="Secure Attachments">
</button>
</div>
</j:jelly>

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2018 03:28 PM
You should be able to use g_form.getUniqueValue() to grab the sys_id of the record where your ui macro is located.
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<div class="label-text" style ='margin-left: 6%;'>Secure Attachments:
<button onclick="saveAttachment('sn_si_physical_security_incident', g_form.getUniqueValue());" id="header_add_attachment" title="" aria-label="Secure Attachments" class="btn btn-icon icon-paperclip navbar-btn" data-original-title="Secure Attachments">
</button>
</div>
</j:jelly>

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2018 03:42 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2018 06:41 PM
Hmm, try this with a return false:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<div class="label-text" style ='margin-left: 6%;'>Secure Attachments:
<button onclick="saveAttachment('sn_si_physical_security_incident', g_form.getUniqueValue()); return false;" id="header_add_attachment" title="" aria-label="Secure Attachments" class="btn btn-icon icon-paperclip navbar-btn" data-original-title="Secure Attachments">
</button>
</div>
</j:jelly>

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2018 08:41 AM
Hi Brad. That works. Thank you.
Could you explain why we have to add the return false?