Hi, I have a document lets say A and Part B. BOM of document A should contain only part B that other parts should not be allowed to added to the BOM of document. How to accomplish this in agile SDK? please help
Hi karthiga,
If you are taking directly Part A- number and Part B- number and create Event PX, It is doable but that will be very bad practice. Instead of taking number define some attributes or use subclass of Part A and Part B like
Part A subclass- Electronic PCB
Part B subclass- Transistor
Part C subclass- Tyre    (which you don’t want to be added)
Then create simple groovy script (pre)event PX on update BOM table of item. Get newly added item rows get subclass of those items. If these subclass user adding are not valid (Like Part C- Tyre) throw exception. Note: When you creating event subscriber don’t forget to add ‘Error handling’ as ‘Error’.
Â
Please let me know if any confusion or doubt.
Hi Saurabh,
This method works fine when single part is added to BOM tab of document. Our requirement is to add Multiple Items to BOM using search.
For Example , if i try to add both Part B Subclass – Transistor and  Part C Subclass – Tyre at a time, it should add PartB subclass Transistor and restrict PartC Subclass – Tyre.
But it allows multiple Items of same Itemtype.
Hi Karthiga,
There is an another method but it requires an strict naming convention.
For example if you have a Document with number DOC-12345 for this document create part with part-12345.
So now its will be easy to validate, you can check if the number after “-” is same for both document and part  is valid so add it else reject or remove it.
If this is also not suite for your requirement you have to go with attribute based restriction through roles and privilege.Â
Regards,
Ganesh