简体   繁体   中英

Suitescript: Can't Get Result From Search

The following is the script that I write for writing back " ship from location" information to Item Fulfillment for a certain customer. But it's not working.

Anyone see a syntax error, know what I might be missing, or what I can test for?

    case "2946":
        var warehousecode = WH_Code_Lookup(customer , location);
        itemfulfillment.setFieldValue('custbody_warehouse_code', warehousecode);// set warehouse code

        // Set Ship from location
        var columns = [];
        columns[0] = new nlobjSearchColumn('address1');
        columns[1] = new nlobjSearchColumn('address2');
        columns[2] = new nlobjSearchColumn('city');
        columns[3] = new nlobjSearchColumn('state');
        columns[4] = new nlobjSearchColumn('country');
        columns[5] = new nlobjSearchColumn('zip');

        var search = nlapiSearchRecord('location', null, new nlobjSearchFilter('internalid', null, 'is', invCheckFlag), columns);

        itemfulfillment.setFieldValue('custbodyship_from_address1', search[0].getValue('address1'));
        itemfulfillment.setFieldValue('custbodyship_from_address2', search[0].getValue('address2'));
        itemfulfillment.setFieldValue('custbodyship_from_city', search[0].getValue('city'));
        itemfulfillment.setFieldValue('custbodyship_from_country', search[0].getValue('country'));
        itemfulfillment.setFieldValue('custbodyship_from_state', search[0].getValue('state'));
        itemfulfillment.setFieldValue('custbodyship_from_postal_code', search[0].getValue('zip'));

        if(location == 6){
            itemfulfillment.setFieldValue('thirdpartyacctups',edi_customer_search[0].getValue('custrecord_2nd_3rd_pty_ups'));
            itemfulfillment.setFieldValue('thirdpartyzipcodeups',edi_customer_search[0].getValue('custrecord_2nd_3rd_pty_ups_zip'));
            itemfulfillment.setFieldValue('thirdpartytypeups','BILLTHIRDPARTY');
        }
        break;

You stated that the code doesn't work. Is there a specific error, as someone asked? Does the search bring back results or is it an issue in the search itself? Did you add any debug code in your script to see if you can pinpoint where the issue may be?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM