Skip to end of metadata
Go to start of metadata

Cprime Apps has been rebranded as Anova Apps. Please note the only effect is the company name - all of our products’ names, logos, functionalities, support, etc. is exactly the same. The new location to our documentation space is https://anovaapps.atlassian.net.

Availability

This routine is available starting with SIL Engine™ 1.0.

Syntax

attachFile(path_to_file, issue)

Description

Add an attachment to a selected issue.

Parameters

Parameter name

Type

Required

Description

path to file

string

Yes

Absolute path to the file.

issue key

string

Yes

Key of the issue the file will be attached to.


Return type

boolean (true/false)

The return value represents the success of the attachment process. If the routine returns "true" the file was attached successfully.

Example

string path_to_file;
string issue;
path_to_file = "C:/jira/home/attachment/file_to_attach_1.jpg";
issue = "PRJ-239";
attachFile(path_to_file, issue);

Result: Returns "true" if the file is at the selected location and the issue exists. It means the file was attached. Returns "false" if any of the conditions stated before are not met.

Notes

  1. Use forward slashes ( "/" ) for the path.
  2. The path to the attachment must be absolute and point to a location on the server.
  3. If an error occurs, the routine will return "false" and the error message will be visible in the log.

See also

3 Comments

  1. Anonymous

    Hi

    Is there a way to set the attachment name?

     

    In the following code, I want to copy attachments from issue orig_key to issue clonekey

    for(number i = 0; i < size(%orig_key%.attachments); i = i + 1){
     string filename=%orig_key%.attachments[i];
     attachFile(getAttachmentPath(orig_key, filename),clonekey);
     
    }

     


    and  I see the internal JIRA attachment ids in the attachment list of clonekey instead of proper filename.

     

    Maybe there is another way to copy attachments from one issue to another?

     

     

     

    1. Anonymous

      I am having the same problem and no solution (sad)

      1. Unknown User (fmanaila)