0

Working on a website in which I pass a recordName to a second page via the URL. I see the correct parse of the recordName {data} and then attempt to use it for a query with a filterBy as follows:

        var query = { recordType: 'Events', 
            filterBy: [{
                fieldName: 'recordName',
                comparator: 'EQUALS',
                fieldValue: {value: [{data}]
                }
            }]
         };

         return publicDB.performQuery(query).then(function (response) {
            if(response.hasErrors) {
                console.error(response.errors[0]);
                return;
            }

            var records = response.records;
            var numberOfRecords = records.length;
            if (numberOfRecords === 0) {
                console.error('No matching items');
                return;
            }

            self.events(records);

This approach and other attempts to specify the fieldName as recordName all produce the same error message:

    ckErrorCode:"NOT_FOUND"
    extensionErrorCode:undefined
    reason:"ObjectNotFoundException: no such field recordName"
    recordName:undefined
    redirectURL:undefined
    retryAfter:undefined
    serverErrorCode:"NOT_FOUND"
    subscriptionID:undefined
    uuid:"7ff93475-a22c-4ae2-859f-4a219e0253b1"
    zoneID:undefined
    message:"ObjectNotFoundException: no such field recordName"

This seems really odd, but perhaps it's something obvious that is easily fixed.

Any suggestions are appreciated.

RLW
  • 1
  • 2

1 Answers1

3

recordName is a system field and below is how you should query for those:

var query = {
    recordType: 'Events',
    filterBy: [{
        comparator: 'EQUALS',
        systemFieldName: 'recordName',
        fieldValue: {
            value: 'the-name-of-the-record'
        }
    }]
}

Due to a known bug, you have to add an additional wrapper around recordName:

var query = {
    recordType: 'Events,
    filterBy: [{
        comparator: 'EQUALS',
        systemFieldName: 'recordName',
        fieldValue: {
            value: {
                recordName: 'the-name-of-the-record'
            }
        }
    }]
}
Max Gunther
  • 296
  • 2
  • 5