This topic contains 2 replies, has 0 voices, and was last updated by TheUsualSuspect 7 years, 1 month ago.
-
AuthorPosts
-
September 22, 2017 at 7:58 am #18282
TheUsualSuspectIn SS 1.0 there is a standalone function that disables fields and line level fields:
nlapiDisableField
nlapiDisableLineItemField
In SS 2.0 there is no standalone function and no function in either the record or currentRecord module to disable fields to my knowledge. Instead the attribute ‘isDisabled’ on a NetSuite field object. According to the documentation this should be used to disable fields like so.
currentRecord.getField({fieldId:’somefield’}).isDi sabled = true;
currentRecord.getSublistField({sublistId: ‘itemprobably’, fieldId:’somefield’, line:0 }).isDisabled = true;
Here is some documentation from SuiteAnswers 61331 of the “isDisabled” attribute for reference:
This property reflects the display type of a field. A value of true means the field is disabled. A value of false means the field is enabled. Note also:If you are working with a body field, you can use this property to change the fieldโs display type.
If you are working with a sublist field, you can set this property to true or false, but be aware that this action affects the entire sublist column, even though a sublist field is associated with one line.
For both body and sublist fields, you can use Field.isDisabled to determine whether the field is disabled or enabled.The issue is that the disabling of sublist fields now relies upon currentRecord.getSublistField to return an object first that can then be modified. However, this function will return a hard SuiteScript error if the line parameter is fed an index that does not exist and you cannot omit this argument. This means a line must be been initialized first and that you are unable to disable line fields in SS 2.0 until at least one line is added.
I currently have a use case where I want to disable a line level field until an asynchronous call returns. I cannot do this if a line has not been added yet which is usually the case when a record is being created.
Are there any alternatives to disabling sublist fields other than downgrading to 1.0 or jQuery hacks that I am not aware of?
This is a cached copy. Click here to see the original post. -
September 22, 2017 at 8:16 am #18283
darrenhillconsultingCheck this out … https://usergroup.netsuite.com/users…save-your-life
Happy Friday
-
September 22, 2017 at 9:00 am #18284
TheUsualSuspectOriginally posted by darrenhillconsulting
View Post
Check this out … https://usergroup.netsuite.com/users…save-your-life
Happy Friday
Thanks! This is an actual case where it makes sense to mix 1.0 and 2.0 until the gap is fixed
Happy Friday
-
AuthorPosts
You must be logged in to reply to this topic.