This topic contains 11 replies, has 0 voices, and was last updated by darrenhillconsulting 7 years, 8 months ago.
-
AuthorPosts
-
October 13, 2016 at 8:02 am #1689
darrenhillconsultingHello all,
According to the 2016.2 release notes, there’s a new function called getCurrentSublistField. Simply use it as follows (as far as the documentation says)
var itemField = Record.getCurrentSublistField({sublistId: ‘item’, fieldId: ‘item’}). Should return a record.Field.
I get a client-side error indicating that function doesn’t exist.
Reading further, the documentation indicates this function is available for transformed records in dynamic mode. So, perhaps its NOT available to client scripts.
Ok then … what I’m TRYING to do is … it a certain field changes on the item line, disable the ‘item’ field on the current line.
How can I achieve this if I cannot access that ‘item’ sublist field and set the isDisabled = true?
I could do this in SS 1.0!!!!
This is a cached copy. Click here to see the original post. -
October 13, 2016 at 8:08 am #1690
JacksonPI’ve done this on a client script pageInit/fieldChanged with this code.
Code:
objRecord.getField({
fieldId: ‘custitem_discontinued’
}).isDisabled = true;
I’m sorry, I read this wrong, you’re working with a sublist. I haven’t tried that yet. -
October 13, 2016 at 8:09 am #1691
darrenhillconsultingFurther to this,
I attempted to simply use the getSublistField function, but apparently that function doesn’t exist on the CurrentRecord either! I get an SSS_INVALID_SUBLIST_OPERATION.
Is there no nlapiDisableLineItemField equivalent in SS 2.0 yet?
-
October 13, 2016 at 8:13 am #1692
darrenhillconsultingEesh … just looked through the SuiteScripts 1.0 to SuiteScripts 2.0 API Map, and there’s nothing listed beside nlapiDisableLineItemField(type, fldnam, val).
Crap
-
October 13, 2016 at 8:32 am #1693
darrenhillconsultingSo,
Against my better judgement, I hacked this. Instead of trying to use Netsuite’s API to disable/enable the sublist ‘item’ field, I did this …
jQuery(‘#item_item_display’).prop(‘disabled’, true);
Don’t tell on me!
david.smith replied on 10/13/2016, 08:43 AM: LOL!
I’d be curious if you could still use the nlapi in your SS2 script. Or does it yell at you?
-
October 13, 2016 at 8:56 am #1694
darrenhillconsultingWe think alike! But ya, it yells at me! So, hack it is!
-
October 13, 2016 at 10:31 am #1695
JacksonPHave you tried working with it in postSourcing instead of fieldChanged?
-
December 13, 2016 at 1:24 pm #1696
tgrimmOriginally posted by darrenhillconsulting
View Post
We think alike! But ya, it yells at me! So, hack it is!
Its not in the documentation that way, but it wouldnt surprise me if Netsuite incorrectly documented something
Code:
N/currentRecord.get().getCurrentSublistField({sublistId: ‘item’, fieldId: ‘item’}).
Only other option I can think of is to get the sublist field with the specific index. Again this is done with the N/currentRecord module and not the regular record module. Give it a shot let me know. -
January 31, 2017 at 5:32 pm #1697
MChammaTXThis looks like it still doesn’t work. Has anyone figured out how to get a sublist field in the current record? My use case is that I want to filter select options in a dropdown sublist field based on the selection of another field.
-
February 1, 2017 at 2:44 pm #1698
krobinson98I was able to get a sublist field to disable within a client script. The following is in the lineInit.
var currentRecord = scriptContext.currentRecord;
var currIndex = currentRecord.getCurrentSublistIndex({
sublistId: ‘item’
});
var objSubrecord = currentRecord.getSublistField({
sublistId:’item’,
fieldId:’amount’,
line:currIndex
}).isDisabled = true;
-
February 2, 2017 at 12:38 pm #1699
JacksonPWhen creating a sublist on the form in a beforeLoad I was able to disable the field this way.
Code:
sublist.addField({
id: ‘title_’,
type: ‘text’,
label: ‘Title’
}).updateDisplayType({
displayType: ‘DISABLED’
}); -
March 21, 2017 at 1:33 pm #1700
darrenhillconsultingOriginally posted by krobinson98
View Post
I was able to get a sublist field to disable within a client script. The following is in the lineInit.
var currentRecord = scriptContext.currentRecord;
var currIndex = currentRecord.getCurrentSublistIndex({
sublistId: ‘item’
});
var objSubrecord = currentRecord.getSublistField({
sublistId:’item’,
fieldId:’amount’,
line:currIndex
}).isDisabled = true;
krobinson98, this didn’t work for me. Are you sure?
-
AuthorPosts
You must be logged in to reply to this topic.