Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Jira runFromCSV to add attachments from a path that includes a field from the CSV

Darryl Lee
Community Champion
February 25, 2021

I have this test.csv:

extid,issue
12345,FOO-123
23456,FOO-124

My attachments are stored in an Attachments folder in my current directory, like so:

c:\foo\Attachments\12345\AttachmentX.xls
c:\foo\Attachments\23456\Attachment1.pdf

This works:

acli --action addAttachments --issue "FOO-123" --file "./Attachments/12345" --recursive"

This fails:

acli --action runFromCsv --file test.csv --common "-a addAttachments --file \"./Attachments/@extid@\" --recursive" --verbose

The relevant error is:

Omit column: extid. It is not a valid parameter for this client.

Ok, that makes sense. Because I really want to just use extid to construct a valid --file parameter.

Of course if I name the column in my CSV file, it is missing the important ./Attachments/ part. And sure, I could go in and bulk replace it, but extid is an actual field in Jira, so I'd prefer to not have to do that for multiple import/export/add attachment operations.

Anyways, I thought a propertyFile might be the way to go, but ugh, the documentation leaves much to be desired. It seems like it's really just for remapping field names, not for any kind of value modification/manipulation.

addAttachment has an optional findReplace parameter, but I guess that's if you want to modify the attachment itself? That's an interesting/weird feature.

runFromCsv also supports findReplace, but again, I guess it's for data INSIDE the CSV? I suppose that would work if I had a character before the extid that I could replace with "./Attachments", but no.

What's weird and confusing is that the @schemeId@ syntax is supported for things like runFromPermissionSchemeList, which is why I ASSumed it would work for RunFromCsv.

I love CLI, but every time I dig into anything complex, the lack of solid documentation drives me crazy.

Also, to the folks from B̶o̶b̶ ̶S̶w̶i̶f̶t̶ ̶a̶n̶d̶ ̶C̶o̶ Appfire that will inevitably offer to create a ticket for me - don't bother. In the past you've created multiple tickets for me (presumably associated with the email I use here), and I still have yet to be able to see them. :-/

The best thing B̶o̶b̶ ̶S̶w̶i̶f̶t̶ ̶a̶n̶d̶ ̶C̶o̶ Appfire could do is to start answering queries like this here in the forum.

</rant>

(Yes, if I could just install Python on the machine I'm running CLI from, life would be much easier.)

3 answers

1 accepted

0 votes
Answer accepted
Avinash Bhagawati {Appfire}
Community Champion
March 2, 2021

Hi @Darryl Lee ,

Thanks for your patience on this.

Can you please try below command.

--action runFromCsv --file "sample.csv" --common "--action addAttachments --file /Users/appfireuser001/Documents/CLI/9.7.0snapshot/@extId@ --issue @issue@ --continue --recursive "  --options setReplacementVariables

Please let us know if you need any additional details on this, we are happy to help you ! 

Thanks,

Avinash

Darryl Lee
Community Champion
March 4, 2021

Upgrading from 9.4.0 to 9.6.0 fixed this! (I completely missed that you were running 9.7.0snapshot)

As you pointed out in the ticket you opened, version 9.6.0 was where you first you added support for setReplacementVariables.

The CLI Release Notes 9.6.0 note that this issue was fixed:

Option to set replacement variables on runFromCsv and runFromSql 

Thank you so much for your help!!!

Like Ravya likes this
Ravya
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 4, 2021

Hi @Darryl Lee 

Glad that it worked for you.

If you have any other questions in the future, please feel free to submit a support ticket through https://bobswift.atlassian.net/servicedesk/customer/portal/1. We will be happy to help you.

Thanks,
Ravya

0 votes
Ravya
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 26, 2021

Hi @Darryl Lee ,

Good day!

We are from Appfire's Bobswift support team. We are working internally with our development team regarding your requirement, will get back to you with updates.

Regards,
Ravya

0 votes
Darryl Lee
Community Champion
February 25, 2021

But hey, for fun let's play along:

c:\foo>  acli --action getClientInfo
Client name: jira, Client version: 9.4.0, Client build: 2020-09-24T03:11:52, Java: OpenJDK 64-Bit Server VM 11.0.5, OS: Windows 10 10.0
c:\foo> acli --action getServerInfo
Jira version: 7.13.5, build: 713005, time: 7/2/19, 12:00 AM, time zone: Pacific Standard Time, description: Jira, url: https://someserver

Sure. It's an old version of Jira. But the client is brand-spanking new.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
7.13.5
TAGS
AUG Leaders

Atlassian Community Events