This topic contains 11 replies, has 0 voices, and was last updated by darrenhillconsulting 7 years, 8 months ago.

  • Author
    Posts
  • #1689

    darrenhillconsulting

    Hello 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.

  • #1690

    JacksonP

    I’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.

  • #1691

    darrenhillconsulting

    Further 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?

  • #1692

    darrenhillconsulting

    Eesh … just looked through the SuiteScripts 1.0 to SuiteScripts 2.0 API Map, and there’s nothing listed beside nlapiDisableLineItemField(type, fldnam, val).

    Crap

  • #1693

    darrenhillconsulting

    So,

    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?

  • #1694

    darrenhillconsulting

    We think alike! But ya, it yells at me! So, hack it is!

  • #1695

    JacksonP

    Have you tried working with it in postSourcing instead of fieldChanged?

  • #1696

    tgrimm

    Originally 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.

  • #1697

    MChammaTX

    This 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.

  • #1698

    krobinson98

    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;

  • #1699

    JacksonP

    When 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’
    });

  • #1700

    darrenhillconsulting

    Originally 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?

You must be logged in to reply to this topic.