31 views

Description

This article describes on how to create a UI macro type variable to attach attachments. This works on both the request catalog form and the RITM form.

 

Release or Environment

All Versions

Instructions

1) Navigate to System UI > UI macros
2) Click New.
3) Provide a Name such as Add_Attachment_Var.
4) In the XML section, copy the paste the following

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<button style="background: #C0C0C0; border-color: darkgrey; color: #3f464f; height:30; width:70"
onclick="saveCustomAttachment();return false">
<b>Please attach file</b>
</button>
<script>
function saveCustomAttachment(){
var tableName = g_form.getTableName();
var sys_id_input = gel('sysparm_item_guid') ? gel('sysparm_item_guid').value : g_form.getUniqueValue();
if(tableName === "ni"){
saveCatAttachment(sys_id_input, 'sc_cart_item');
}else{
saveAttachment('sc_req_item', sys_id_input);
}
}
</script>
</j:jelly>

5) Using this Add_Attachment_Var macro , create a new macro type catalog variable in the required catalog item.

Article Information

Last Updated:2019-12-28 22:08:44
Published:2019-12-29