Chavan AP
Kilo Sage

Custom Attachment button and use it anywhere in the form Using UI Macro and Formatter

 

Create a UI Macro for an Attachment:

  1. Navigate to System UIUI Macros.
  2. Click New.
  3. Complete the form.(name it as add_attachment)
  4. In the XMLscript field enter below Script:

 

<?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 type="button" onclick="saveAttachment(g_form.getTableName(), g_form.getUniqueValue())">Attachment</button> 

</j:jelly>

 

Refer below SS:

find_real_file.png

 

 

 

Create a Formatter :

  1. Navigate to System UIFormatters.
  2. Click New.
  3. In the Namefield, enter a descriptive name for the formatter.(In our case name would be Attachment on Form)
  4. In the Formatterfield, enter the name of the UI macro with .xml appended to it. (In our case UI Macro name would be add_attachment)
  5. In the Table field, select the table in which the formatter will be used.
  6. In the Type field, select Formatter.
  7. Click Submit.   

Refer below SS:

find_real_file.png

 

 

 

 

Yes we are done here , now lets open an Incident form layout and add our Attachment on Form formatter in a form and save it as shown below:

 find_real_file.png

 

Now in an Incident form you will see the Attachment button as shown below:

 find_real_file.png

 When you will click on it , you will be having an ability to attach a file:

find_real_file.png

I am open for suggestions and improvement so feel free to comment on the article.

That’s all guys, if you find this article helpful please like, share and Subscribe!!

 

See you

Ajay

+91-9769949577

 

Comments
Puja Kumari1
Tera Contributor

nice doc .. keep it up

Ryax
Tera Expert

Hi Ajay,

 

Firstly, thank you for such clear instructions - this works perfectly.

 

We would really like to implement the same thing on our Catalog item forms on the portal (so the button will appear amongst catalog item varaibles). Do you have an idea as to how we might achieve this?

 

Rich

Mike Patel
Tera Sage

Attachment as variable is available in Paris release.

find_real_file.png

RAHUL Khanna1
Mega Guru

We have attachment icon present on almost all the forms both in platform as well portal, so what is the specific need of creating it.

 

Also save attachment  function is that OoB or custom, if so what is the code in it.

Kushal Palli
Tera Contributor

Great Document. Can you please help me how to have same functionality in Agent Workspace view? Thanks.

Version history
Last update:
‎10-16-2019 12:11 PM
Updated by: