I have a customer record inheriting a school (cust...
# suitescript
k
I have a customer record inheriting a school (custom record) when updating the fields on the school (custom record) the values don't change on the customer record. Is there a way to create a script to updated those fields even when they are stored values?
n
Yeah a quick UE script deployed on the school record to do a record.submitFields() on the customer record. Script context is edit. Get customer record id get field values submitFields to customer record
You could potentially even just do this with a workflow
k
Here is some custom code that I wrote for the problem. Are you any good at using the script debugger?
Copy code
refine(['N/currentRecord', 'N/record'],(currentRecord, record)=> {

            var objRecord = currentRecord.get();

            var standardRoyalty = objRecord.getValue({
                fieldId: 'custrecord_lf_school_std_roy_perc'
            });
            var headwearRoyalty = objRecord.getValue({
                fieldId: 'custrecord_lf_school_hdwr_roy_perc'
            })
            var id = record.submitFields({
                type: record.Type.CUSTOMER,
                id: 3698,
                values: {
                    'custentity_lf_hdwr_roy_new': headwearRoyalty,
                    'custentity_lf_std_roy_rate_new' : standardRoyalty
                }
            })
});
n
Never really needed to, so i've never messed with it. Your very first line has a misspelled word though i think. Its "define" not "refine"