Forum Discussion
6 Replies
- eli_donahueCommunity ManagerHi fdxu168, Just to confirm - are you looking for a way to set a default extended classification for new Parts? Or do you want to prompt users to select an extended classification before the new Part form loads? Eli
Eli Donahue Aras Labs Software Engineer - Former_MemberAccelerator IIII want to set a default extended classification for new Parts when the new part form loads, so users don’t have to select them. Is this possible?
- angelaCatalyst IIHi fdxu168, I came accross your post as I currently also work with extended classification. I think your use case can be solved with a Method. xClasses are linked to Parts like this: PART -> Relationship
PART_XCLASS--> Related ItemXCLASS(e.g. class 'Resistor') I think it´s possible to add the PART_XCLASS relationship with an onBeforeAdd/onAfterAdd Method.- KittyIdeator II
angela Hi Angelalp, I was searching the exact same solution and found your answer.
I tried to do this by kick the Method with onBeforeAdd or by AML, but It didn't worked to me.
Do you have any further info on this topic?
my method
[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:bd8bfb92-a7d7-4709-a80b-51156ba3bbe9:type=csharp&text=Innovator%20inn%20%3D%20this.getInnovator%28%29%3B%0D%0Athis.setAction%28%22edit%22%29%3B%0D%0AItem%20xclass%20%3D%20inn.newItem%28%22xClass%22%2C%22get%22%29%3B%0D%0Axclass.setProperty%28%22id%22%2C%22F55659D7906F4E3A89767FEEFF1913C0%22%29%3B%0D%0Axclass%20%3D%20xclass.apply%28%29%3B%0D%0AItem%20rel%20%3D%20this.createRelationship%28%22y_ext_xClass%22%2C%22add%22%29%3B%0D%0Arel.setRelatedItem%28xclass%29%3B%0D%0Areturn%20this%3B]and I got this
No items of type 'y_ext_xClass' found using the criteria:
<Item type="y_ext_xClass" id="6BFA1DD7EC1B4AB19C7ACAF59AE8C5C8" serverEvents="1" select="*[is_not_null()]" />- angelaCatalyst II
Your query in general is a bit confusing :). Your "createRelationship" happens after apply(). And you do the apply() on your xClass item and not at the item you want to edit.
I haven´t tested this one, but I think it worked somehow like this:
this.setAction("edit");
Item xyz_xclass= this.createRelationship("xyz_xClass", "add");
Item xclass= xyz_xclass.createRelatedItem("xClass", "get");
xclass.setProperty("id","123");
Item res = this.apply();But I recommend that you check the official documentation. There is a guide regarding xClasses with many samples.
BTW: If you use thumbnails, I would be happy for additional feedback regarding this topic! Thanks!