Hi All, I am trying to create a client script on i...
# suitescript
e
Hi All, I am trying to create a client script on inventory adjustments: when editing a custom transaction line field (type list/record: inventory number), the transaction sublist line will populate with all available inventory from that inventory number at a chosen location and fill out the inventory detail. Use case is that it will be a 'quick dispose' method to remove all quantity for a given lotcode. Seems simple and I do exactly the same thing in a UE script but for a client script I get this error: Not supported on current subrecord: CurrentSubrecord.setCurrentSublistValue.. I am in dynamic mode and have confirmed this. Seems to be the same problem mentioned in this slack thread https://stackoverflow.com/a/68638757 Is this not possible client-side? Code snippet below. I have also tried variations of this in the browser console with no luck.
Copy code
// select and add a line to the inventory detail subrecord. There will be exactly one line.
      const invDetailSubrecord = rec.getCurrentSublistSubrecord({
        sublistId: 'inventory',
        fieldId: 'inventorydetail'
      });
      invDetailSubrecord.selectNewLine({
        sublistId: 'inventoryassignment'
      });
      [
        { sublistId: 'inventoryassignment', fieldId: 'quantity', value: -1 * quantity },
        { sublistId: 'inventoryassignment', fieldId: 'receiptinventorynumber', value: batchCodeString }
      ].forEach(function (fieldValue) { invDetailSubrecord.setCurrentSublistValue(fieldValue); });

      invDetailSubrecord.commitLine({
        sublistId: 'inventoryassignment'
      });
e
Well that's dumb. Thank you though, I was not aware of that section of the help docs, might have helped me out with a different issue as well.
b
the address subrecord actually can be set via client script, despite what the docs say
e
Yeah that's what piqued my interest. For the life of me I can't get my users to stop selecting the 'override' checkbox on addresses. This article makes me hopeful I can digitally slap them when they try to select it.
🤣 1
b
you can deploy a client script on the address subrecord instead
which is actually a supported deployment method