How to get project key?

Roman Akhmetov May 16, 2019

How can I get project key if I know issue's key of my project? What function should I use in SIL/Power Scripts?

3 answers

1 accepted

1 vote
Answer accepted
Roman Akhmetov May 16, 2019

I've found answer. If you're interesting in that: "(issuekey).project"

0 votes
Roman Akhmetov May 16, 2019

I mean another. There's my script:

string[] CL_issues_K1;
string[] issues_K1 = selectIssues("SLA_START" = breached() and created > startOfDay(-1)");

for(string iss in issues_K1){
     CL_issues_K1 = createIssue("CL_SLA", "", 11604, %iss%.summary);
     %CL_issues_K1%.customfield_15116 = "SLA_START";
     %CL_issues_K1%.assignee = %iss%.assignee;
     %CL_issues_K1%.description = "|"+ %iss%.key + " | " + %iss%.customfield_10103;
}

 

I created custom field called SD PROJECT KEY (id 15120). How can I get project key if I know project's issue key?

For example: Issue's key - "CL_SLA-100". How to get "CL_SLA"?

0 votes
Dave Theodore [Coyote Creek Consulting]
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 16, 2019

The Project Key is the prefix of the issue number.  In the example of JRA-123, the "JRA" portion of the issue number is the Project Key. 

If you're on a unix-based operating system, `cut` does this sort of stuff easily.

$ echo JRA-123|cut -d "-" -f1
JRA
$

 

Suggest an answer

Log in or Sign up to answer