Update script parameter field value in company preference
Hi Guys, How do i update script parameter field value in company preference thru script?
Please follow the below code snippet:
/** * companyPreferences.js * @NApiVersion 2.x * @NModuleScope Public */ //Sample Config load and get Value or set Value define(['N/config'], function (config) { //Please visit config module for types in help function loadCompanyPreferences() { const shopifyApi = config.load({ type: config.Type.COMPANY_PREFERENCES //depends on your requirement }); const apiKey = shopifyApi.getValue('field ID'); shopifyApi.setValue('field ID', 'value'); shopifyApi.save(); //You can use the ignore or field sourcing } return { compPref: loadCompanyPreferences } });