This topic contains 7 replies, has 0 voices, and was last updated by tgrimm 7 years, 9 months ago.
-
AuthorPosts
-
November 29, 2016 at 12:01 am #1465
Rusty ShacklesIn 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. -
November 29, 2016 at 5:10 am #1466
Olivier Gagnon NCYeah 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.
-
November 29, 2016 at 7:11 am #1467
MikeBucklaewI’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?
-
November 29, 2016 at 10:54 am #1468
Olivier Gagnon NCThey released field.getSelectOptions() like 2 weeks ago, so haven’t played with it to find out how it behaves.
-
November 29, 2016 at 3:41 pm #1469
michoelOriginally 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”.
-
December 1, 2016 at 3:01 pm #1470
cblackburngetText 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. -
December 1, 2016 at 4:09 pm #1471
michoelOriginally 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.
-
January 24, 2017 at 4:24 pm #1472
tgrimmOriginally 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….
-
AuthorPosts
You must be logged in to reply to this topic.