Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Rename File/Image attachments

Edited

I have a form that requires the attachments submitted with the confiform be named with specific naming convention. There are two problems that I am having; first, how to access the attachment file name from the confiform macros; second how to change the names of multiple attachments. 

My first thought was to use a IFTTT onCreated rule, but that there is only delete or copy attachment. I thought if I could copy the attachments to a page and use an onModified IFTTT rule I could change the name that way. Neither approach has proven to work beyond the copy of attachments to a new page. 

Users can upload docs to the form and the form needs to transform the doc:

example.pdf to asAttachment.displayTitle=[entry.my_Field]_[entry.my_Field1]_[entry.my_Field2][entry.my_Field3][entry.my_Field4]_BU[entry.asAttachment(0)index#]_[entry.my_Field5]_[entry._now.formatDate(yyyyMMdd)]

WTC000000_3333_AD22221111_BU(1-#)_$250_20210407

The BU(#) just needs to be the index number for the attachment. 

Is this operation even possible with the ConfiForm toolset?

1 answer

You can use asAttachment function to establish a bridge to Attachment object that can be queried for any property it has, including the "displayTitle" - https://wiki.vertuna.com/display/CONFIFORMS/Virtual+functions 

 

Renaming attachments is not currently supported by ConfiForms natively

The only option you have at the moment is to set up a web service request and use something like https://docs.atlassian.com/ConfluenceServer/rest/7.11.2/#api/content/{id}/child/attachment-update 

Alex

Hello @Alex Medved _ConfiForms_ 

I need to copy an attachment to a created page and rename the file name. No problem creating the page and attaching the file, however I can't use the API for security reasons. When I rename the file manually using the properties of the attachment it changes the "form page" field of the macros of the created page by doubling the name of the space. example: "space: space: page" the macros cannot work without manually modifying the "page of the form" field.

Hi

Is this related to ConfiForms in any way? Could you be more specific?

Thanks

Alex

Re @Alex Medved _ConfiForms_ 

It is in connection with Confiforms. I use an ifttt macro to create a page with a tableview macro inside and then use another ifttt macro to copy an attachment to the created page. It works very well.

However when I rename the attachment with the Attachments Properties ability of Confluence it changes the link to the Confiforms form page of the tableview macro by doubling the name of the Confluence space.

Could you help me to understand how to reproduce this?

Where does it "double" the space name? Any screenshot? 

It is the pageTitle attribute which is modified following the renaming of the file. No problem as long as you don't change the file name.

The attachment was copied after it was appended to a form with the ConfiForms Form Field Definition macro with the Field type = File / attachment attribute.

I will try to add the attachment to the form without using this macro, I have a feeling that might work. I will keep you informed.

pageTitle-twice.PNGmacro-TableView.png

I found a workaround, I added a text field named "pageForm" valued with the name of the page where the form is located. Then I use [entry.pageForm] in pageTitle of the TableView macro included in the body of the ifttt macro that creates the page. I don't know why but this way the problem goes away.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence

Confluence Mythbusters: Does Atlassian even use Confluence?

Hi, Confluence collaborators! As part of #Confluence-Collaboratory month, we’ve created a very special Mythsbusters segment, where we're dive into an interesting myth and uncover the truth behind i...

1,384 views 7 29
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you