• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups
    3 Kudos

    Scripting Access BOM & Sourcing Tab

    Status: Implemented
    by Contributor DonovanJr on ‎12-03-2012 11:37 AM

    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.

     

    Status: Implemented

     

    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()

     

    Comments
    by Employee jared.sund on ‎01-27-2013 07:45 PM
    Status changed to: Accepted
     
    by Employee jared.sund ‎04-08-2013 07:37 AM - edited ‎04-08-2013 07:38 AM
    Status changed to: Implemented

     

    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()

     

    Announcements
    IdeaStation Guidelines
    Review guidelines and best practices
    before posting a new idea


    PLM 360 Survey