I would like to prevent an inbound shipment from b...
# suitescript
s
I would like to prevent an inbound shipment from being received unless certain info is filled correctly on the inbound shipment (besides making the fields mand)
e
you can prevent server side in a
beforeSubmit
routine by throwing an error and not allowing the transaction to save
s
I want the receive button not to work
e
“not to work” can mean a few things. a) hide it on the form
beforeLoad
b) disable it
beforeLoad
c) disallow the receipt to even load
beforeLoad
d) disallow the receipt to save
beforeSubmit
s
before load disable it
e
getButton and then set the disabled = true propery. note, not sure if it disables top and bottom button on the form, need to verify that
s
do you mean befroe submit or pageinit ?
e
this can be done beforeLoad in User Event, using the form element of the scriptContext
similar for the edit button below
Copy code
var btnEdit = scriptContext.form.getButton({id: 'edit'});
    		if (!isEmpty(btnEdit) && disableEdit)
    		{
    			btnEdit.isHidden = true;
    		}
only you want a different button, and you’ll need to look up the property for disabled - probably isDisabled? or enabled?
s
Copy code
This method is not supported for standard NetSuite buttons.
e
where did you get that?
s
I am talking about the standard receive button not a custom
e
where did you receive an error?
s
that is from the link you sent
e
interesting. you can do isHidden on the Receive button, according to this link: https://suiteanswers.custhelp.com/app/answers/detail/a_id/10376 You may try something client side as well, but not sure. may have to do DOM scripting to get to it
b
e
FYI, I’ve done this (isHidden) with the edit button and it did indeed work - so although possibly undocumented/supported, it works
b
at this point you probably want to notice the difference between Button.isHidden and Button.isDisabled
s
im reading on that know