Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

this.getItemsByXPath("Relationships..) doesn´t work for other ItemTypes #6

Open
AngelaIp opened this issue Oct 4, 2018 · 1 comment
Assignees
Labels
Type: Question I want to know more about this project.

Comments

@AngelaIp
Copy link
Contributor

AngelaIp commented Oct 4, 2018

Hi,

in the Method 'Convert ECR to ECN' is the following code block:

// Add Affected Items
var affItems = this.getItemsByXPath("Relationships/Item[@type='ECR Affected Item']");
for (var i=0; i<affItems.getItemCount(); i++) {
  ...
}

It reads the related Affected Items from the original ECR to transfer it to the new created ECN.
For change processes, this Method works well and always returns the relationships. It doesn´t matter if I start the Action from the grid of Form, both works fine.

Now I want to reuse this code block for a "Convert Part to something else" Action. When I build a duplicate of the Action and Methods, the above code block doesn´t work for Parts the same way as for Change Processes.

var amlItems = this.getItemsByXPath("Relationships/Item[@type='Part AML']");
return alert(amlItems.getItemCount());

When I try to read the related Manufacturer Parts the same way as the Affected Items, most of the time no Relationships will be returned.
When I trigger the Action from the Part grid, I will always get an item count of 0.

What is different here? I wonder why this one actually works in change processes at all. Were does it get it´s data for the relationships?

Thx
Angela

@AngelaIp
Copy link
Contributor Author

My 'Part AML' sample required this additional request to work:

// Add Manufacturer Parts
itm.fetchRelationships("Part AML");
var amlItems = itm.getItemsByXPath("Relationships/Item[@type='Part AML']");

This is not an uncommon construct. But I really wonder, why the original sample can get the related Affected Items without the use of fetchRelationships at all.

@EliJDonahue EliJDonahue self-assigned this Mar 23, 2019
@EliJDonahue EliJDonahue added the Type: Question I want to know more about this project. label Mar 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Question I want to know more about this project.
Projects
None yet
Development

No branches or pull requests

2 participants