https://netsuiteprofessionals.com logo
#general
Title
# general
a

Artur_K

04/29/2022, 1:28 PM
Hello people Is it possible to show the transaction number of a purchase order only after approval? and hide it before? Perhaps remove the div?
c

Corey Schwoebel

04/29/2022, 1:58 PM
It would be possible to manipulate the DOM via a client script. There may be a better option as well though, one that's not as hacky.
a

Artur_K

04/29/2022, 2:02 PM
Do you have resources to manipulate the DOM? I'm trying it at the moment with this code, but no luck.. I'm not sure which module to load to create the form
Copy code
/**
    *@NApiVersion 2.0
    *@NScriptType UserEventScript
    *@NModuleScope SameAccount
*/

define(['N/ui/serverWidget', 'N/record', 'N/runtime', 'N/email', 'N/search', '/SuiteScripts/third-party-doc/lib/moment.min'], function(form, record, runtime, email, search, moment) {

    function beforeLoad(context) {
        var form = context.form;
        var field = form.addField({
            id: 'custpage_code',
            type: 'inlinehtml',
            label: 'Code'
        });

        field.defaultValue = '<script>' +
            'document.getElementByClassName("uir-record-id").style.display = "none";' +
        '</script>';

    }
        

    return {
        beforeLoad: beforeLoad,
    }
});
I found the error:
Copy code
'document.getElementByClassName("uir-record-id").style.display = "none";' +
must be:
Copy code
'document.getElementsByClassName("uir-record-id")[0].style.display = "none";' +
c

Corey Schwoebel

04/29/2022, 2:24 PM
I haven't tested it to see if it's necessary, but i have a client script that accesses the DOM with only the Record module loaded. I do believe it's available without calling any of the SS modules though.
3 Views