cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Scripting Access BOM & Sourcing Tab

Scripting Access BOM & Sourcing Tab

We need access via the Server Side Sripting to both the BOM Tab & Sourcing Tab.

 

I believe there are several support threads as well as Ideastation references to this functionality but I felt we needed a clear Idea Post for this functionality.

 

Similar to the new object record item.workflowitems recently added we need to have information contained in the BOM & Sourcing tabs for use in scripting.

 

An example would be having an assembly shown on an Sakes Quote Grid and a workflow that would explode the BOM children of that assembly into the grid of an RFQ and access the default supplier to create a master RFQ for cloning quoting purposes.

 

Ideally this would be read/write access for back feed updating of costing etc.

 

4 Comments
jared.sund
Alumni
Status changed to: Future Consideration
 
jared.sund
Alumni
Status changed to: 投票募集中

 

BOM Final implementation:

RELATED and QUANTITY are required, others are optional:
item.boms.addBOM({ RELATED: part1, QUANTITY: 1.2, CUSTOM_FIELDS: { FIELD: 'value' }, ITEM_NUMBER: 10, QUOTE: part1.sourcing[0].quote[1] })

First two arguments are required, others are optional:
item.boms.addBOM(part2, 2.3, { FIELD: 'value' }, 11, part2.sourcing[1].quote[2])

var bom = bom;

Can assign:
bom.item.ANY_CUSTOM_FIELD
bom.qty
bom.quantity - Synonym for bom.qty
bom.quote
bom.ANY_CUSTOM_FIELD

Can read:
bom.id
bom.item
bom.item.ANY_CUSTOM_FIELD
bom.itemNumber
bom.descriptor
bom.qty
bom.quantity - Synonym for bom.qty
bom.quote - See Sourcing Tab support for fields which can be read
bom.ANY_CUSTOM_FIELD

bom.remove()

NOTE: You can assign to quote, for example:
bom.quote = target.sourcing[0].quote[1];

However, you cannot change the quote through the BOM:
bom.quote.min = 10;
is not guaranteed to persist changes to the quote. To ensure that changes are persisted, change the quote via the sourcing:
target.sourcing[0].quote[1].min = 10;


Sourcing/Quote implementation:

SOURCING:

Everything but SUPPLIER is optional:
item.sourcing.addSourcing({ SUPPLIER: supplier1, SUPPLIER_PART_NUM: 'ABC-123', MANUFACTURER: 'Manufacturer Name', MANUFACTURER_PART_NUM: 'MAN-123', COMMENT: 'Comment', CUSTOM_FIELDS: { FIELD: 'value' } })

Everything but first argument is optional:
item.sourcing.addSourcing(supplier2, 'XYZ-789', 'Other Manufacturer', 'OTH-789', 'Comment', { FIELD: 'value' })

Can assign:
item.sourcing[0].supplier
item.sourcing[0].supplierPartNumber
item.sourcing[0].manufacturer
item.sourcing[0].manufacturerPartNumber
item.sourcing[0].comment
item.sourcing[0].ANY_CUSTOM_FIELD

Can read:
item.sourcing[0].supplier
item.sourcing[0].supplierPartNumber
item.sourcing[0].manufacturer
item.sourcing[0].manufacturerPartNumber
item.sourcing[0].comment
item.sourcing[0].quote
item.sourcing[0].quote.id to get quote ID
item.sourcing[0].ANY_CUSTOM_FIELD

item.sourcing[0].remove()

QUOTES:

Args are: min, max, leadTime, leadTimeType, unitCost, comment
leadTimeType can be 1, 7, 30, 365, 'Days', 'Weeks', 'Months', or 'Years':
item.sourcing[0].addQuote(100, 200, 12, 'Days', 12.34, 'Comment')

Can assign:
item.sourcing[0].quote[1].min
item.sourcing[0].quote[1].max
item.sourcing[0].quote[1].leadTime
item.sourcing[0].quote[1].leadTimeType - Can be values listed above
item.sourcing[0].quote[1].unitCost
item.sourcing[0].quote[1].comment
item.sourcing[0].quote[1].default - true or false

Can read:
item.sourcing[0].quote[1].id
item.sourcing[0].quote[1].min
item.sourcing[0].quote[1].max
item.sourcing[0].quote[1].leadTime
item.sourcing[0].quote[1].leadTimeType - Will give values above
item.sourcing[0].quote[1].unitCost
item.sourcing[0].quote[1].comment
item.sourcing[0].quote[1].default - true or false

item.sourcing[0].quote[1].remove()

 

vmoyseenko
Contributor

It would be nice to update WikiHelp.

 

I spent a lot time trying to find a workaround.

 

Thank you!

nguyentru
Alumni
Status changed to: Implemented
 

Can't find what you're looking for? Ask the community or share your knowledge.

Submit Idea  

Autodesk Design & Make Report