Need help with JIRA Sil Script.

I need to create a post script function that creates a subtask for each person in a certain role.

The biggest piece I am having a problem with is getting the group of users from the custom field, then making them the issue assignee.

I tried writing my script myself and ended up with something sort of like this, this is code/pseudo code of what I need.

string SUMMARY = "Document ERB Assessment";
string[] users= customfield_12500

for(string user : users) 
{
    string issueKey = createIssue(project, key, "DOC ERB Assessment",SUMMARY[]);
	%issueKey%.assignee = "user";
}

 

 

 

4 answers

Similar issue was discussed here: https://answers.atlassian.com/questions/290405

Also to create a subtask you would need to use a "Sub-task" as issue type:

//create subtask
string subtask_key = createIssue(project, key, "Sub-task", subtaskSummary);

Hi Alexis,

 

You need the issue type as well. Note that you need a subtask issue type(standard or custom). Inside the for block you may want to use isUserInRole if you need to act based on the user's roles. Here is a crash course for SIL syntax to get started and feel more productive.

https://confluence.kepler-rominfo.com/display/SIL30/Syntax

https://confluence.kepler-rominfo.com/display/SIL30/Statements

 

Have fun with SIL!

The DOC ERB Assessment is the subtask type, it is just a custom type.

 

This is the route I am trying right now.

 

string SUMMARY = "Document ERB Assessment";
 
for(string user in customfield_12500)
{
  string issueKey = createIssue("SFMSS", parent, "DOC ERB Assessment", SUMMARY);
  %issueKey%.assignee = "user";
}

Why are you using string array as SUMMARY and not a single string ? string SUMMARY = "Document ERB Assessment";

That is actually just an copy/paste error in actual implementation I did not use an array.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

152 views 1 17
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you