‎13-11-2023 02:54 PM
Hello,
I'm facing the next problem. I have a list with applications and portfolios to which they should belong, so I want to create a new portfolio and make sure I connect a certain application to it.
The problem is, that in Hopex there is an intermediate object between Portfolio and Application, an Initiative, so it looks like this: Portfolio -> Initiative -> Application (other direction as well).
When I'm using Web Hopex, I simply add an Application to the newly created Portfolio and Initiative is being created automatically with me doing nothing for this. But how do I automate that?
For example, I have the next GraphQL query to retrieve all Applications connected to my Portfolio:
query{ portfolio(filter:{name_contains:"0 test"}){ name initiative{ id application{ name } }}}
And to update the Portfolio the query should look something like this:
mutation{ updatePortfolio(id:"123456" portfolio:{ application:{ action:ADD list:[{"654321"}] }})}
But it doesn't work due to Initiative in the middle is required.
Should I create Initiative by myself in order to connect Application with Portfolio? If yes, then what is the best way to do that? Is there another approach to achieve that via GraphQL?
Or maybe it's better to do using JAVA API? Would appreciate that as well.
Thanks!
Solved! Go to Solution.
‎13-11-2023 04:33 PM
Ok, I think I've managed how to do that. Here's the query:
mutation{ createInitiative(initiative:{ name:"AppName" application:{ action:ADD list:[{id:"654321"}] } portfolio:{ action:ADD list:[{id:"123456"}] }}){ id name }}