Search code examples
formsfieldnetsuiterecordpopulate

How to populate fields of an online form


I created a custom record (child of Inventory item) and an online form. The final goal it's to send a link to a user (not a netsuite user) to display the different informations of this custom record. The user will be able to update some values and submit the form.

I saw it's possible to link a script file to this form, but I need the ID of the record to load it and populate every field of the form.

With normal forms, we have the internalid of the record as an URL param but in this case there is nothing in the URL .

Do you know any way to achieve that ?


Solution

  • A solution for the final goal could be:

    1. Create an empty Suitelet (provides external link for User). Or refer to step 4 for contents.

    2. Stored on the Custom record or via script (created in step 3) you can add to the external link, to include the record type and id as url parameters (&recordtype=customrecord&recid=12345). Be sure to avoid reserved parameter names.

    3. Create a UserEvent, Client, or Scheduled Script to send email to User based on your requirements (in the email include the custom external suitelet link). User will click on the link and land on a NetSuite looking webpage (not requiring credentials).

    4. Modify empty Suitelet. Suitelet should when context.request.method===GET: get parameters, load record(s), get data from record(s), create form, display data to User, display fields for User to enter data, add submit and refresh/cancel button, write/display the form with all fields. Upon submission (when context.request.method is not GET) you can use record.submit method to update the custom record(s).

    NetSuite Suite Answer Id 74607 has a Sample Custom Form Suitelet Script from that can be very helpful.