Portfolio Rule Trigger 'Work Added To Portfolio' Doesn't Run When Added via API

After much anticipation, our organization finally upgraded to the new pricing plan which unlocked the ‘Portfolio Rules’ feature. I had been looking forward to implementing this basic rule:
- When work is added to the portfolio > set a custom field to a value

Much to my dismay, the rule doesn’t fire. Numerous projects have been added to the portfolio, but none of the projects have triggered the rule.

Our project creation process utilizes the API to instantiate projects, and add them to portfolios programatically. Does anyone know if making changes to projects via the API bypasses built-in Portfolio rule triggers?

Appreciate any insights.
Thanks!

@as_an_android, I moved your post to the English Forum > Developers & API forum section so it will get better visibility with the Asana API/dev folks.

@John_Baldo @John_Vu can you perhaps check this out?

Also @as_an_android, just to confirm: the rule runs fine when you add a project with the Asana UI? You’ve definitely pinpointed it to be an API issue?

@Phil_Seeman appreciate the quick reply.

Yes, the portfolio rule trigger works fine when projects are added to the portfolio via web or app UI. The issue only occurs when project are added to portfolios via the API. For context, I haven’t tested other triggers using the API - only the ‘Work is added to portfolio’ trigger.

Hi @as_an_android,

I tried reproducing this on my end but and did not run into the same issue as you. Here is how I tested:

SETUP:

  1. Create a new portfolio: PORTFOLIO_A
  2. In side of PORTFOLIO_A → Customize → Fields → + Add
  3. Created a single select custom field called “SELECT THIS” with 2 options “OPTION_1” and “OPTION_2”
  4. In side of PORTFOLIO_A → Customize → Rules → + Add
  5. “When…” → selected “Work is added to portfolio”
  6. “Check if…” → clicked on the X
  7. “Do this…” → under “Change custom field to…” sub section → Change “SELECT THIS”“Choose an option for SELECT THIS” to “OPTION_1”
  8. Saved the rule

TEST 1: New project

  1. Created a project called PROJECT_A
  2. Made an API Call to Add a portfolio item (POST /portfolios/{portfolio_gid}/addItem) with PORTFOLIO_A and for item I provided the GID of PROJECT_A
  3. Saw that the rule ran and set “SELECT THIS” custom field to “OPTION 1”

TEST 2: New project from project template

  1. Created a project called PROJECT_B using Instantiate a project from a project template (POST /project_templates/{project_template_gid}/instantiateProject) endpoint
  2. Made an API Call to Add a portfolio item (POST /portfolios/{portfolio_gid}/addItem) with PORTFOLIO_A and for item I provided the GID of PROJECT_B
  3. Saw that the rule ran and set “SELECT THIS” custom field to “OPTION 1”

@as_an_android can you give us more details on how you’ve setup your portfolio, projects and your “Stage” custom field? If we can reproduce the issue we can narrow down the issue.

Thanks @Phil_Seeman for moving the post

2 Likes

@John_Vu thank you for thoroughly testing this issue.

I was mistaken - my workflow makes an API call to instantiate a new project from a template. That template specified that new projects created using the template should be added to the portfolio.

Rather than try to figure out why that doesn’t work, I’ve adjusted my workflow to use the /portfolios/{portfolio_gid}/addItem endpoint to add new projects to the portfolio, as this successfully triggers the built-in portfolio rules.

Appreciate your help!

Thanks for pointing me in the right direction, @Phil_Seeman !

1 Like

@as_an_android Thank you for clarifying what you did. This behavior looks like a bug. We have a fix on the way for this.

3 Likes