How can i load and edit a customer profile in a RESTlet?

I’m trying to write a Restlet in Suitescript 2.0 to get a customer record and edit its credit card field from an external mobile application. I access to the Restlet using a customer account and Oauth 2.0, and I need get his own profile and edit it, but the response is :

“INSUFFICIENT_PERMISSION\”,\”message\”:\”Permission Violation: You need the \’Lists -> Customers\

I can’t put the customer permission in List > Customers into the customer role, because netsuite platform doesn’t allow it. So… How can i do it!?… Help me, please!

function editCustomerCreditCard(requestBody) {

        var user = requestBody.customer

        var customer = record.load({
            type: record.Type.CUSTOMER, 
            id: user.internalid,
            isDynamic: true
        });

        return JSON.stringify(customer)
     
     ...
}
Rookie Asked on May 20, 2020 in Other.
Add Comment
1 Answer(s)

You’ll probably need to refactor the script as a Suitelet and use the “Execute as role” setting in this case.

Beginner Answered on May 22, 2020.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Limebox   Become a Sponsor   Become a Sponsor