How to keep value in field in suitelet form after submit?


Hi, I have created a Suitelet from where user can select the “Start Date” and “End Date” on the basis of the time period transaction would be shown their after clicking on “Submit” button. and its running fine…. but the value of the date field(Start Date and End date) is lost.. I want to keep it in the field..

I have not used any client script for this entire task. its all happening  through suitelet script. I used  record.setValue but its not working its showing me error like its not a function so on.. please help… How can I keep the field value in field after submitting. Thanks!!


Add Comment
6 Answer(s)


If you’re setting it in the Suitelet, I think you’ll set the value using the .defaultValue property for the field.



Advanced Answered on May 23, 2022.
Add Comment

Hey Chris Thanks to Guide,

you mean Field.defaultValue = custdate;

I have already done this but its showing me  error like “”TypeError: Cannot set property ‘defaultValue’ of undefined [at Object.onRequestForm . even I have mentioned the module as well..


Rookie Answered on May 24, 2022.
Add Comment

Could you please share the snippet of code where you create the field?

Advanced Answered on May 24, 2022.
Add Comment

Yes sure….

RE: How to keep value in field in suitelet form after submit?

RE: How to keep value in field in suitelet form after submit?

both are in GET method

Rookie Answered on May 26, 2022.
Add Comment
Best answer

You’ve got to be careful here. You’re setting var toDateValue = form.addField(…).isMandatory = true;

So, you’re effectively setting toDateValue = true and will not be able to call any further methods.

You’re better doing:

var toDateValue = form.addField(...);
toDateValue.isMandatory = false;
toDateValue.defaultValue = ...

Hope that makes sense.



Advanced Answered on May 27, 2022.
Add Comment

Hey Chris,

Wow, its amazing… yes its working….  Thank you from the bottom of my heart..

I am really surprise how it is working. means  I would never think  to do this because at the time of adding any field we do not have value so its hard to think but now got your point. Thanks Chris..!!

Rookie Answered on May 31, 2022.

That’s a pleasure and I’m glad it’s working!

on May 31, 2022.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Become a Sponsor   Become a Sponsor