Forum Discussion

Hargul_Sidhu's avatar
Hargul_Sidhu
Ideator I
2 years ago
Solved

How to find ECR, ECO, EDR associated with PR using API GET call?

Hi,

I need the data for all the PRs and ECR, ECO, EDR etc associated with the PR. 

By associated I mean the ones that show in the "where used" section of PR and not the relationships.  In other words, what is the "where used' equivalent in a GET call?

I then need the properties of  the Affected Items under each ECR, ECO, EDR. 

I can get the properties of the relationshipships. GET call in Postman:

https://nmg.dev.aras-cloud.com/staging/server/odata/PR?$expand=NMG_PR_AffectedItem

This only gets the Affected Items under PR, I can get other relationships and their properties but the issue is there isn't a relationship between PR and ECR under PR item type


  • Hi Hargul,

    I think the best way to achieve this would be to utilize a Query Definition(QD). A QD can traverse a relationship in both directions, including your "Where Used" scenario. The first step would be to build a query definition which starts with PR and uses a Referencing Item relationship to query the items which reference the given PR.

    Once you have a query you're happy with I recommend taking a look at this forums post where someone needed to get a query response via the Rest API. You'll have to create a quick method which calls your QD, and then the method can be called via a POST request.

    AJ

2 Replies

  • Hi Hargul,

    I think the best way to achieve this would be to utilize a Query Definition(QD). A QD can traverse a relationship in both directions, including your "Where Used" scenario. The first step would be to build a query definition which starts with PR and uses a Referencing Item relationship to query the items which reference the given PR.

    Once you have a query you're happy with I recommend taking a look at this forums post where someone needed to get a query response via the Rest API. You'll have to create a quick method which calls your QD, and then the method can be called via a POST request.

    AJ