Hello All, Can we use executeMacro function in use...
# suitescript
t
Hello All, Can we use executeMacro function in user event script?
b
its supported serverside and clientside
though some of the macros dont do anything interesting serverside
t
How to use this in server side....can you plz share me an example....
b
which macro
t
Execute macro
b
these are the supported macros, with extremely boring syntax. Its more likely that you are doing something wrong rather than not using the correct syntax https://system.na0.netsuite.com/app/help/helpcenter.nl?fid=section_1516982642.html
which macro are you trying to use
t
We want to calculate tax using
b
relatively boring
newRecord.executeMacro({id:'calculateTax'});
generally unneeded serverside, netsuite will automatically calculate taxes when a record is saved
keep in mind that it only works with SuiteTax
t
I wrote the client script to calculate tax but when i bill in the context of Batch Processing then client script does not work. When i use this function in user event script i got the error ' Cannot find function executeMacro in object standard record'. Is there any way to fire executeMacro function in user event script?
Is there any way to fire executeMacro function in user event script? /** *@NApiVersion 2.x *@NScriptType UserEventScript */ define(['N/record'],function(record){ function beforesubmit(context) { var newrec_obj = context.newRecord; newrec_obj.executeMacro({id:'calculateTax'}); } return{ beforeLoad:beforesubmit }; });
b
only works on dynamic mode records
which you won't get from an uyser event context