Hello, I am working on inventory detail subrecord ...
# suitescript
m
Hello, I am working on inventory detail subrecord of item receipt and need to mark bin number field required. I have tried to UserEvent script, I get no errors but it doesn't mark the field required.
Here is the code that I am testing define ( ['N/record', 'N/ui/serverWidget'] , // Add the callback function. function(record, serverWidget) { function myBeforeLoad (context) { if (context.type !== context.UserEventType.CREATE && context.type !== context.UserEventType.EDIT) return; var form = context.form; var subrec = objRecord.getCurrentSublistSubrecord({ sublistId: 'item', fieldId: 'inventorydetail' }); var binField = subrec.getSublist({id: 'inventoryassignment'}).getField({id: 'binnumber'}); binField.isMandatory = true; } return { beforeLoad: myBeforeLoad, }; });
c
When do you want it to be mandatory, seeing as you're trying to exclude edit mode?
s
you can make that field mandatory? I thought Inventory detail sub record is not exposed anywhere
m
Thanks CD for pointing that out...I fixed != to = but I am getting this error Cannot find function getCurrentSublistSubrecord in object serverWidget.Form
b
the error is not wrong, Form Object Members are not the same as record members
its unlikely that you would be able to do this in a user event script anyways
you should be attempting to client script deployed to your inventory details