How do I save and submit form data in netsuite?

I need to save and submit the information for a form for enrollment > employees, each time it is filled out.  I need to save and submit the information for a form for enrollment > employees each time it is filled out. I sent an image of where I want the information to be stored. I created a send button, but it doesn’t send

How do I save and submit form data in netsuite?

 

 

/**
*@NApiVersion 2.x
*@NScriptType Suitelet
*/
define([‘N/ui/serverWidget’], function (serverWidget) {
    function onRequest(context) {
        var formulario = serverWidget.createForm({
            title: ‘Formulário’,
            hideNavBar: false
        });
        formulario.addCancelButton({
            id: ‘btnCancel’,
            label: ‘Cancelar’
        })
        formulario.addSubmitButton({
            id:’btnsubmit’
            label: ‘Enviar’
        });
        formulario.addField({
            id: ‘sublista_campo1’,
            label: ‘Código empresa’,
            type: serverWidget.FieldType.INTEGER
        });
        formulario.addField({
            id: ‘sublista_campo2’,
            label: ‘Código funcionário’,
            type: serverWidget.FieldType.TEXT
        })
        formulario.addField({
            id: ‘sublista_campo3’,
            label: ‘Código evento’,
            type: serverWidget.FieldType.INTEGER
        });
        var fieldReference = formulario.addField({
            id: ‘sublista_campo4’,
            label: ‘Referência’,
            type: serverWidget.FieldType.INTEGER
        });
        var fieldValue = formulario.addField({
            id: ‘sublista_campo5’,
            label: ‘Valor’,
            type: serverWidget.FieldType.FLOAT
        });
        formulario.addField({
            id: ‘sublista_campo6’,
            label: ‘Mês e ano’,
            type: serverWidget.FieldType.DATE
        });
        if (fieldReference === ” && fieldReference === null) {
            fieldReference.defaultValue = ‘0000’
        };
        if (fieldValue === ” && fieldValue === null) {
            fieldValue.defaultValue = ‘0000’
        }
        context.response.writePage(formulario);
    };
    return {
        onRequest: onRequest
    };
});
Rookie Asked on September 3, 2021 in SuiteScript.
Add Comment
1 Answer(s)

Hi,

You will need to process the data that is submitted. You can see the principle in this article:

https://netsuite.custhelp.com/app/answers/detail/a_id/94597

In summary, your script should have two sections:

if (context.request.method === 'GET') {

–> Displays the form.

if (context.request.method === 'POST') {

–> Processes the data and perhaps displays a confirmation.

Thanks,

Chris

Intermediate Answered on September 7, 2021.

thanks, Chris!

How do I get CancelButton to work? I want him to cancel the form submission.

on September 8, 2021.
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   Limebox   Become a Sponsor