I’m trying to call the following: ``` let re...
# suitescript
b
I’m trying to call the following:
Copy code
let recordInstance = record.load({
        type: "customer",
        id: result.id,
      });
But I’m getting a type record mismatch error:
"type":"error.SuiteScriptError","name":"SSS_RECORD_TYPE_MISMATCH","message":"The record you are attempting to load has a different type: job from the type specified: customer."
Any idea what I might be doing wrong?
s
the value of
result.id
is not the internal id of a customer. i.e. most likely it's exactly what that error message fairly clearly states.
b
@Shawn Talbert thanks for your help! That’s interesting because I got the
result.id
from
search.create
Copy code
let recordSearch = search.create({
      type: "customer",
    });    

    let records = [];
    let dataPages = recordSearch.runPaged({ pageSize: 1000 });
    let pageData = dataPages.fetch(0);
    pageData.data.forEach(function (result) {
      let recordInstance = record.load({
        type: "customer",
        id: result.id,
      });
      records.push(getRecordData(recordInstance));
    });
n
The error explains that the ID that you are trying to load is for the job/project and not the customer.
b
Thanks all! That worked for me