Alert message before record save using user event script.

Jira Code :SMT-11

/**

 * @NApiVersion 2.x

 * @NScriptType UserEventScript

 * @NModuleScope SameAccount

 */

 /******************************************************************************

     * SMT-11 UE show alert on save

      ******************************************************************************

     *

     * Date: 18-06-2019

     *

     * Author: Jobin & Jismi IT Services LLP

     *

     *******************************************************************************

     **/

define([‘N/search’, ‘N/record’, ‘N/format’],

    function(search, record, format) {

        function beforeLoad(scriptContext) {

            try {

                var form = scriptContext.form;

                var jobField = form.addField({

                    id: ‘custpage_hideid’,

                    type: ‘INLINEHTML’,

                    label: ‘hidden’

                });

                //var html = “<script>console.log(jQuery(‘.bdtabblock’));jQuery( document ).ready(function() { jQuery(‘.bdtabblock’).css(‘pointer-events’, ‘none’); });alert(‘af’)</script>”

                var html = “<script>jQuery(‘#edit,#secondaryedit,#spn_secondarymultibutton_submitter,#btn_multibutton_submitter’).click(function(){alert(‘Please Check your Edit Permissions with Adminstrator’);window.location.reload()});</script>”;

                //.ac_div  

                //jQuery(‘.uir-header-buttons’).hide();

                jobField.defaultValue = html;

            } catch (err) {

                log.debug({

                    title: ‘err’,

                    details: err

                });

            }

        }

        return {

            beforeLoad: beforeLoad

        };

    });

Leave a comment

Your email address will not be published. Required fields are marked *