This topic contains 2 replies, has 0 voices, and was last updated by pr57001 8 years, 2 months ago.

  • Author
    Posts
  • #1817

    ssilveri77

    On a filfillment record. I can get this

    subrecordInvDetail = rec.getCurrentSublistSubrecord({ sublistId : ‘item’,

    fieldId : ‘inventorydetail’ });

    Which gives me the inventory detail.

    But I cannot seem to get to inventoryassignment so I can get the issueinventorynumber

    Has anyone done this?
    This is a cached copy. Click here to see the original post.

  • #1818

    fjannelle

    Good morning,

    You will need to iterate through the Inventory Assignment sublist to obtain the desired values. Sample:

    PHP Code:

     var lineCount = inventoryDetailSubRecord.getLineCount({
                    sublistId: ‘inventoryassignment’
                });

    for (var i = 0; i < lineCount; i++) {

                    var inventoryNumberInternalId = inventoryDetailSubRecord.getSublistValue({
                        sublistId: 'inventoryassignment',
                        fieldId: 'issueinventorynumber',
                        line: i
                    });

                    log.debug('inventoryNumberInternalId', inventoryNumberInternalId);
                } 

    In 2.0 the getValue call returns the internal ID of the serial/lot number and the getText equivalent does not work. Depending on the exact logic you need to execute for the obtained numbers you might need to call a subsequent saved search to obtain the actual serial/lot numbers and not internal IDs (an 'inventorynumber' search will do the trick).

    Best regards,

  • #1819

    pr57001

    Are you able to use issueinventorynumber when creating (vs viewing) an Item Fuflillment or and Inventory Adjustment. We have not been able to get either to work in SS2 with various errors about the Inventory Detail not being set.

    Below, using Inventory Number Internal Id, gives us

    Please configure the inventory detail in line 1 of the item list.

    PHP Code:

                var objRecord = record.transform({
                    fromType: record.Type.SALES_ORDER,
                    fromId: 604962,
                    toType: record.Type.ITEM_FULFILLMENT,
                    isDynamic: true,
                });
                
                var lineNum = objRecord.selectLine({
                    sublistId: ‘item’,
                    line: 0
                });
                
                
                
                objRecord.setCurrentSublistValue({
                     sublistId: ‘item’,
                     fieldId: ‘quantity’,
                     value: 1
                 });
                
                   objRecord.setCurrentSublistValue({
                    sublistId: ‘item’,
                    fieldId: ‘location’,
                    value: 8
                });
                
                   
                   var hasSubrecord = objRecord.hasCurrentSublistSubrecord({
                       sublistId: ‘item’,
                       fieldId: ‘inventorydetail’
                   });
                   
                   log.debug(‘hasdet’,hasSubrecord);

                   //here create subrecord
            subrecordInvDetail = objRecord.getCurrentSublistSubrecord({
                     sublistId: ‘item’,
                     fieldId: ‘inventorydetail’
                 });
          
        
         
             
                 subrecordInvDetail.selectNewLine({
                     sublistId: ‘inventoryassignment’
                 });
                 
                 
                 var id_to_use=null;
                 
                 //Roll Id / Our Number
                 //id_to_use=’2146626′; 
                 
                 //inventory number internal id
                 id_to_use=84460;
                     
                 
                 subrecordInvDetail.setCurrentSublistValue({
                     sublistId: ‘inventoryassignment’,
                     fieldId: ‘issueinventorynumber’,
                     value:     id_to_use
                 });
             subrecordInvDetail.setCurrentSublistValue({
                     sublistId: ‘inventoryassignment’,
                     fieldId: ‘quantity’,
                     value: 1
                 });
                 subrecordInvDetail.commitLine({
                     sublistId: ‘inventoryassignment’
                 });
                         
                objRecord.save();

You must be logged in to reply to this topic.