Tuesday, February 5, 2019

getParameter on Checkbox Returns Blank Value Instead of F When Unchecked on Suitelet

As per Help Center, nlobjRequest is a primary object used to encapsulate an HTTP GET or POST request. When creating Suitelets you will pass request and response arguments to your user-defined function. With the request object instantiated, you can then call any nlobjRequest method. 

Note: This article requires knowledge in SuiteScripts: Suitelets.

The nlobjRequest method seen below us the getParameter(name) that returns the value of the request parameter.

Results:
    If the checkbox is checked, a value of T is seen and ifthe checkbox is unchecked, no value is shown.


With theresults seen above, one might get confused that the value is Null and notFalse. What we can do is to add another variable that can output 'T' or 'F' andwe can use that variable on the nlapiLogExecution instead. To return 'T' or 'F'as value of checkbox for POST in a suitelet, additional conditions can be addedto set the value to 'F' if null.

No comments:

Post a Comment