Nuri Ensing
Nuri Ensing

Reputation: 2030

Record does not exist when using record transform

Via Celigo I am calling a RESTlet script. This is my script:

define(['N/log', 'N/file', 'N/query', 'N/record', 'N/runtime'],
    function (log, file, query, record, runtime) {


        function customerToVendor(request) {

            log.error('recordDetails', JSON.stringify(request));

            try {
                var objRecord = record.transform({
                    fromType: record.Type.CUSTOMER,
                    fromId: request.customerId,
                    toType: record.Type.VENDOR,
                    isDynamic: true,
                });
                var objRecordId = objRecord.save();

                var response = {};
                response['info'] = objRecordId;

                return response;

            } catch (e) {
                log.error('ERROR', String(e));
                throw e;
            }
        }

Very straight forward. I want to transform a Customer also into a Vendor. However I am getting a response that the record does not exist:

 {
  "error": {
    "code": "RCRD_DSNT_EXIST",
    "message": "{\"type\":\"error.SuiteScriptError\",\"name\":\"RCRD_DSNT_EXIST\",\"message\":\"That record does not exist.\",\"stack\":[\"Error\n    at RecordInvoker.save (suitescript/resources/javascript/record/serverRecordService.js:371:13)\n    at NetSuiteObject.thenableFunction() .....
,\"notifyOff\":false},\"id\":\"4286\",\"notifyOff\":false,\"userFacing\":true}"

  }
}

The customer record with id 4286 is existing: enter image description here

So what is going wrong here?

Upvotes: 0

Views: 869

Answers (1)

It could be role permission or restriction problem.

Does the integration role have permission to see customers? or is there any restriction related to subsidiaries or employees?

Something you can do is assign the role to yourself and check that you're able to see the customer.

Upvotes: 0

Related Questions