JM
04/26/2021, 4:39 AMJM
04/26/2021, 4:41 AMJM
04/26/2021, 4:42 AMif(type == 'create' && exec_context == 'USERINTERFACE'){var cfrom_id = scriptContext.request.parameters.cfrom_id;if(cfrom_id!= ''){var cfrom_type = scriptContext.request.parameters.cfrom_type;var cfrom_rec = record.load({type: cfrom_type,id: cfrom_id});var ia_location = cfrom_rec.getValue('location');newRecord.setValue('customer', cfrom_rec.getValue('entity'));newRecord.setValue('subsidiary', cfrom_rec.getValue('subsidiary'));newRecord.setValue('custbody_itg_created_from_transaction', cfrom_id);newRecord.setValue('department', cfrom_rec.getValue('department'));newRecord.setValue('class', cfrom_rec.getValue('class'));newRecord.setValue('account', 58);newRecord.setValue('adjlocation', ia_location);var cfrom_line = cfrom_rec.getLineCount('item');var productionquantity = 'custcol_prod_quantity_1_entre';if(cfrom_line>0){var linedisplay = 0;for(var x=0; x<cfrom_line; x++){var item_type = cfrom_rec.getSublistValue('item','itemtype',x);if(item_type== 'InvtPart'){var item_id = cfrom_rec.getSublistValue({sublistId : 'item',fieldId : 'item',line : x});newRecord.setSublistValue({sublistId : 'inventory',fieldId : 'item',line : linedisplay,value : item_id});newRecord.setSublistValue({sublistId : 'inventory',fieldId : 'location',line : linedisplay,value : ia_location});var adjustqty = parseFloat(cfrom_rec.getSublistValue({sublistId : 'item',fieldId : productionquantity,line : x}));if(adjustqty == ''){adjustqty = 0;}newRecord.setSublistValue({sublistId : 'inventory',fieldId : 'adjustqtyby',line : linedisplay,value : adjustqty});newRecord.setSublistValue({sublistId : 'inventory',fieldId : 'units',line : linedisplay,value : cfrom_rec.getSublistValue({sublistId : 'item',fieldId : 'units',line : x}),});linedisplay++;}}//START FOR RAW MATS//START FOR RAW MATS//START FOR RAW MATSvar totalsheets_search = searchRecords('customrecord_hnd_total_sheets',[["custrecord_hndts_mainlink","anyof",cfrom_id],"AND",["custrecord_hndts_inventory_adjustment","anyof","@NONE@"]],[search.createColumn({name: "custrecord_hndts_total_sheets", label: "Total Sheets"}),]);var totalsheets = 0;if(totalsheets_search){if(totalsheets_search.length>0){totalsheets = parseFloat(totalsheets_search[0].getValue({name:'custrecord_hndts_total_sheets'}))*-1;}}newRecord.setSublistValue({sublistId : 'inventory',fieldId : 'item',line : linedisplay,value : 4630//ITEM INTERNAL IF OF RAW MATERIAL});newRecord.setSublistValue({sublistId : 'inventory',fieldId : 'location',line : linedisplay,value : ia_location});newRecord.setSublistValue({sublistId : 'inventory',fieldId : 'adjustqtyby',line : linedisplay,value : totalsheets});linedisplay++;//END FOR RAW MATS//END FOR RAW MATS//END FOR RAW MATS}}}battk
04/26/2021, 4:44 AMbattk
04/26/2021, 4:45 AMJM
04/26/2021, 5:07 AMJM
04/26/2021, 5:07 AMJM
04/26/2021, 5:09 AMif(ctxmode == 'create'){var cfrom_id = currentRecord.getValue('custbody_itg_created_from_transaction');if(cfrom_id!= ''){var cfrom_rec = record.load({type: 'salesorder',id: cfrom_id});var ia_location = cfrom_rec.getValue('location');log.debug('PAGEINIT - ia_location',ia_location);var cfrom_line = cfrom_rec.getLineCount('item');log.debug('PAGEINIT - cfrom_line',cfrom_line);var productionquantity = 'custcol_itg_prod_quantity_1_entre';if(cfrom_line>0){for(var x=0; x<cfrom_line; x++){var currIndex = currentRecord.getCurrentSublistIndex({sublistId: 'inventory'});log.debug('currIndex',currIndex);log.debug('x',x);var item_type = cfrom_rec.getSublistValue('item','itemtype',x);//							currentRecord.selectLine({sublistId:'inventory',line:linedisplay});log.debug('item_type',item_type);if(item_type == 'InvtPart'){currentRecord.selectNewLine({sublistId:'inventory'});var item_id = cfrom_rec.getSublistValue({sublistId : 'item',fieldId : 'item',line : x});currentRecord.setCurrentSublistValue({sublistId : 'inventory',fieldId : 'item',value : item_id,});currentRecord.setCurrentSublistValue({sublistId : 'inventory',fieldId : 'location',value : ia_location,});currentRecord.setCurrentSublistValue({sublistId : 'inventory',fieldId : 'adjustqtyby',value : cfrom_rec.getSublistValue({sublistId : 'item',fieldId : productionquantity,line : x}),});currentRecord.setCurrentSublistValue({sublistId : 'inventory',fieldId : 'units',value : cfrom_rec.getSublistValue({sublistId : 'item',fieldId : 'units',line : x}),});currentRecord.setCurrentSublistValue({sublistId : 'inventory',fieldId : 'custcol_hnd_skuline',value : cfrom_rec.getSublistValue({sublistId : 'item',fieldId : 'custcol_hnd_skuline',line : x}),});currentRecord.commitLine({sublistId:'inventory'});//								NLInvokeButton(getButton('inventory_addedit'))}}}}}JM
04/26/2021, 5:09 AMbattk
04/26/2021, 5:10 AMJM
04/26/2021, 5:22 AMJM
04/26/2021, 5:55 AMbattk
04/26/2021, 6:17 AMbattk
04/26/2021, 6:18 AM