Hello people Is it possible to show the transactio...
# general
a
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
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
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
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.