RE: Suitelet Bug? currentRecord.setValue()

Has anyone experienced a bug where currentRecord.setValue() does not work on clientScript of form, getting error “selectmap is not defined”

I have narrowed this down to being on SELECT fields that are added to the form on POST request method, and when they are popup style (i.e. values/text need to be queried rather than showing up in dropdown)

This appears to be because the Suitelet client script runs a GET request query to get the appropriate Label to populate in the field, but the response comes back empty (I assume since the field was added on POST, it isnt aware of the fieldId on a GET request)


dbarnett Intermediate Asked on May 26, 2020 in SuiteCloud.

You’ll probably need to share a lot of your code, specifically the field addition and the form rendering on GET vs POST.

on May 26, 2020.

There’s no difference really, at the end of both GET & POST just have:
`response.writePage({ pageObject : form });`

I am thinking anyone should be able to replicate this, just having a Submit button on the form and then adding an additional certain field on the Form object in scenario of request.method === ‘POST’

on May 26, 2020.
Add Comment
1 Answers

This is behavior related to the Maximum Entries in Dropdowns preference. Requests that get a list for your select field generate a GET request to your suitelet. Your suitelet is supposed to write back the same page object (or if for some reason you are being ultra efficient, a page object with the field being requested).

You can log the request parameters to see what the parameters for the GET are. I’m not sure which is ideal for determining if the GET is this sort of request since this is undocumented behavior.

Advanced Answered on May 26, 2020.

Yeah that’s basically what I was seeing when I was stepping through the client code
this is the kind of request it is sending in case anyone is curious :

Your comments led me to a working solution though, all I needed to do was just add the Field on the GET request portion as well, but just hidden displayType since I did not need it at that time.  Then the above Url GET request was able to successfully retrieve the info it needed to proceed properly

on May 26, 2020.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.