I spent some effort on a workaround that achieves what I want.
1. Add a new value to the 'Flagged' custom field, which I think comes pre-configured with a single value, 'Impediment'. The new value should be called 'Sync to Portfolio'.
2. Create a Calculated Text Field called 'Sync to Portfolio', with the following code as the description (weird place to put code, but that's how this custom field is configured). This keeps the 'Sync to Portfolio' custom field in sync with the value of the parent epic's 'Sync to Portfolio' flag. Your custom fields will probably have different ids.
<!-- @@Formula:
/* If there's an Epic Link, go to that epic and seach the Flag values for "Sync to Portfolio".
If found, returns "Yes", otherwise returns "No".
*/
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.fields.CustomField;
import java.util.List;
CustomFieldManager cfm = ComponentAccessor.getCustomFieldManager();
CustomField flags_customfield = cfm.getCustomFieldObject(new Long(10100));
String epic_link_fieldname = "customfield_10106";
String sync_flag_value = "Sync to Portfolio";
String yes = "Yes";
String no = "No";
if (issue.get(epic_link_fieldname) != null)
{
List flags = issue.get(epic_link_fieldname).getCustomFieldValue(flags_customfield);
if (flags != null) {
for (Object o : flags) {
if (o.getValue().equals(sync_flag_value))
return yes;
}
}
}
return no;
-->
3. Create a filter called 'Import to Portfolio' which you will use in Portfolio:
(Flagged = "Sync to Portfolio" OR "Sync to Portfolio" ~ Yes) AND resolution = Unresolved
4. Set the 'Sync to Portfolio' flag on all epics you'd like to see in Portfolio
5. Reindex and confirm you can see the 'Sync to Portfolio' custom field saying 'Yes' for child stories of those epics
6. Import in Portfolio using the above filter
7. Open another beer
Notes:
- I named the flag value and the custom field the same thing; you don't have to.
- If you hit problems, catalina.out will help you debug it
Further steps:
- To only show the 'Flagged' field on the edit screen for Epics only (and not Stories - it would be confusing to have 2 places to see 'Sync to Portfolio', with potentially conflicting information), I made a 'Default screen for Epics' that includes the 'Flagged' field, and a corresponding 'Epic screen scheme' and 'Epic issue type screen scheme'. Finally, my 'Projects' project in JIRA is associated with this Issue Type Screen Scheme and the spell is complete.
- Note: All my Epics are in a single project called Projects, all other projects have the actual stories, but cannot have Epics. This fits one of Portfolio's ways of working with Epics/Stories.
This issue relates to Portfolio Classic Plans, which is no longer supported in Portfolio for JIRA Cloud.
Thanks,
Bree