Is it possible to pass a value to a sublist using ...
# suitescript
m
Is it possible to pass a value to a sublist using resolveRecord in the N/url module? I'm creating a new item record off of a custom record and need to set the Base Price of the item, which is in the price1 sublist. The user clicks a button and a Client Script pulls in field (all body) values and populates the new Item Record accordingly through the param option. I've been all over the internet, but haven't found a way to push the value over. Sample code:
Copy code
// In the client script, I get these values from the originating record
var description = rec.getValue('custrecord_br_itdv_item');
var basePrice = rec.getValue('custrecord_br_itdv_item_base_price');

// I can set the body fields using the N/url Module
var newItemURL = urlModule.resolveRecord({
    recordType: recordModule.Type.INVENTORY_ITEM,
    isEditMode: true,
    params: {
        'record.displayname':description
    }
});


// BasePrice is located in a sublist on the item record though.
   // In a different Script (Suitelet that serves a different purpose) I set base price via:
      newItemRecord.setSublistValue({sublistId: 'price1', fieldId: 'price_1_', line: 0, value: basePrice});
b
none known, you are supposed to use the Pricing Sublist / Pricing Matrix apis to set the pricing related fields
m
Would that apply to other sublist fields too? It's not hard to get the user to add a few things when the record is created - I just want to be ready for their 'whatabouts'. 🙂
b
you wouldnt use the matrix related apis for other sublist fields, but in general you would need to script adding sublists
m
Got it. Thanks!