Get the sys_id of the current record in UI macro

Michael Chaiwi2
Kilo Contributor

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>

find_real_file.png

1 ACCEPTED SOLUTION

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>

View solution in original post

5 REPLIES 5

I believe it's trying to submit the page if you don't do that.