This topic contains 7 replies, has 0 voices, and was last updated by tgrimm 7 years, 9 months ago.

  • Author
    Posts
  • #1465

    Rusty Shackles

    In 1.0, you can nlapiGetFieldText to get the text value of a list/drop-down field. I tried using record.getText but I get this error:

    “name”:”SSS_INVALID_API_USAGE”,”message”:”Inva lid API usage. You must use getValue to return the value set with setValue. ”

    Not sure if it has any relevance but the field I am using it against is ‘custrecord_2663_entity_file_format’ and ‘custrecord_2663_entity_bank_type’
    This is a cached copy. Click here to see the original post.

  • #1466

    Olivier Gagnon NC

    Yeah SS2.0 is whacky like that. I think you need to be in dynamic mode to getText, but I’m not clear on that. Anyway, yeah, you often cannot getText. Part of life under SS2.0.

  • #1467

    MikeBucklaew

    I’m just starting to play with SS 2.0. Would an idea be to use field.getSelectOptions() which returns an array like [{value: 5, text: abc},{value: 6, text: 123}] and then find the text yourself from that once you get the numeric value?

  • #1468

    Olivier Gagnon NC

    They released field.getSelectOptions() like 2 weeks ago, so haven’t played with it to find out how it behaves.

  • #1469

    michoel

    Originally posted by Rusty Shackles

    View Post

    In 1.0, you can nlapiGetFieldText to get the text value of a list/drop-down field. I tried using record.getText but I get this error:

    “name”:”SSS_INVALID_API_USAGE”,”message”:”Inva lid API usage. You must use getValue to return the value set with setValue. ”

    Not sure if it has any relevance but the field I am using it against is ‘custrecord_2663_entity_file_format’ and ‘custrecord_2663_entity_bank_type’

    Per the SS 2.0 for Experienced SS Developers course, this is a known bug in N/record.getText() which NS is aware of which has already been reported, but, “feel free to submit another report as customer submitted issues are typically given priority”.

  • #1470

    cblackburn

    getText is supported in the following scenarios:Dynamic Record Mode {isDynamic : true}
    User Event Scripts for records obtained from context.newRecord with the caveat that once the field has been set using setValue it cannot be retrieved using getText (which would require the text value to be derived from the id value and is not permitted for performance reasons)
    We will be updating the help documentation with this information, sorry for the inconvenience.

  • #1471

    michoel

    Originally posted by cblackburn

    View Post

    User Event Scripts for records obtained from context.newRecord with the caveat that once the field has been set using setValue it cannot be retrieved using getText (which would require the text value to be derived from the id value and is not permitted for performance reasons)

    The error message seems to say the opposite though.

  • #1472

    tgrimm

    Originally posted by michoel

    View Post

    The error message seems to say the opposite though.

    AHA! I was having the same issue, working on a user event in the context of beforeSubmit on a custom record. I was doing two things:

    Code:
    lockrId = rec.getValue(‘customfield’);
    lockrIdText = rec.getText(‘customfield’);
    I needed both the value and the text for two different things. I too was getting the error “SSS_INVALID_API_USAGE” which according to help is because it was “Invoked prior to using setText in standard record mode”. Taking that inaccurate and vague explanation and the equally inaccurate reason “…. with the caveat that once the field has been set using setValue it cannot be retrieved using getText…” from our friend above. I extrapolated that perhaps in my scenario the issue is that I am called xxxValue() on the field in question before doing the getText(). Turns out, that was the issue. You cannot call a xxxValue() (getValue, or setValue()) on a field before attempting to getText() on that same field in the context of context.newRecord on a user Event.

    I believe the lesson to be learned here is that if you do ever need to getText() on a field in a User Event script, you must do so early in the call because once either setValue() or getValue() are called on a field it eliminates the text method of that field permanently. Hopefully this gets fixed because that is quite ridiculous, performance reasons set aside, this sounds like a miss on NetSuite’s side. Just remember SS 2.0 is for sure better than 1.0….

You must be logged in to reply to this topic.