Hello, using a client script, is it possible to di...
# suitescript
m
Hello, using a client script, is it possible to disable a field (or entire column) of the item sublist on an Estimate? I've tried with Suitescript 1.0 and 2.0 to no avail. Only the newline is disabled but not the ones that already contain values 😞 . Thanks!
e
If I'm not wrong you could do it using a BeforeLoad UE script, I think I did this in the past.
🙌🏼 1
m
Thanks @eminero, I'll give that a try.
e
context.form.getSublist('salesteam').getField('contribution').updateDisplayType({ displayType: serverWidget.FieldDisplayType.HIDDEN });
👍 1
m
great stuff!
🙌 1
e
The above code run on sales orders and opp, look in the doc for the disable, I was using the
.HIDDEN
option.
m
Will do, thank you.
@eminero Did not work. It does disable the newline field (item field in my case) but it will still let you click/edit the fields in other lines that already have a value in it. I've spent like 4 hours and tried 3 different scripts, 1 of those in SuiteScript 1.0 and still don't get it headbang. Maybe it is not possible to disable a sublist field if it already has a value in it?
e
Share your code, it's pretty weird.
m
sure
Copy code
const beforeLoad = (scriptContext) => {

            try {
                    log.debug('Disabling...','');
                    scriptContext.form.getSublist('item').getField('item').updateDisplayType({ displayType: serverWidget.FieldDisplayType.DISABLED });
                    log.debug('Disabled?','');
                
            } catch (error) {
                log.debug("error" , error);
            } 
        }
e
I see, I just did a quick search in suiteanswers, it says the postSourcing might be affecting, check this link: https://suiteanswers.custhelp.com/app/answers/detail/a_id/66632/loc/en_US
This is an. approach using a client script.
m
Thanks, I'll give those a try. If that works I'm buying you a coffee.
e
Crossed fingers! fingers crossed
b
netsuite will undisable a field that it sources
m
YES! it worked
Yeah @battk. That's gotta be it. This worked:
Copy code
function clientPageInit(type){
	
	console.log("Init");
    nlapiSetLineItemDisabled('item','item',true);
}

 /**
  *
  * @param type
  * @param name
  */
 function clientPostSourcing(type, name) {
    nlapiSetLineItemDisabled('item','item',true);
}


 /**
  *
  * @param type
  */
 function clientLineInit(type) {
    nlapiSetLineItemDisabled('item','item',true);
}
I have to clean things up and figure out where to put it, also rewrite in 2.0 maybe.
@eminero Send me you paypal or w/e via DM, I'm buying you that coffee.
1
@battk Want one to? You are a fountain of knowledge and I see you helping a lot around here.
b
nah
m
@battk Cool. Thanks a lot for your help, nevertheless.