Hi All, I have a suitelet form that has address fi...
# suitescript
x
Hi All, I have a suitelet form that has address fields. Separate fields for country, state, zip, etc. I have a client script running on this form to change the list of states depending on the country chosen. I run a 'state' search on the client to lookup and get the dropdown options on fieldchange. It works completely fine in admin role but this form will be used by the customer role. When I test through the customer role I am getting:
Copy code
Permission Violation: You need  the 'Set Up Company' permission to access this page. Please contact your account administrator.
I even tried to create a state saved search in the ui and do a search.load with the run unrestricted checked/public check and I am still running into the above issue.
Copy code
function getStates(country) {

console.log('-Function getState-');
            var arrResults = [];
            var stStateId = '',
                stStateFullName = '',
                stStateShortName = '',
                stCountry = '';
             
                    var selectedCountry = search.createFilter({
                        name: 'country',
                        operator: search.Operator.ANYOF,
                        values: [country]
                    });

                    var searchObj = search.load({
                        id: 'customsearch_ss_lookup_states'
                    });
                    searchObj.filters.push(selectedCountry);

            searchObj.run().each(function(result) {
                var ssColumns = result.columns;
                stStateId = result.getValue(ssColumns[0]);
                stStateFullName = result.getValue(ssColumns[1]);
                stStateShortName = result.getValue(ssColumns[2]);
                stCountry = result.getValue(ssColumns[3]);
                arrResults.push(new stateItem(stStateId, stStateFullName, stStateShortName, stCountry));


                return true;
            });


            return arrResults;

        }
I obviously can't give the set up company permission to the customer role, it seems weird that it is even asking for that permission? I'm not changing/adding states, I'm merely trying to look them up in the client script.
e
Check out this thread. Pretty much, you can't set permissions on a client script. So you're client script can't perform a search because it doesn't have any permissions. https://netsuiteprofessionals.slack.com/archives/C29HQS63G/p1633613152289100
x
Ah thanks a bunch Eric, I had a feeling something like that was happening