0

I have the following code which checks for an ID and then calls a function on retrieve in the remoting call in salesforce. Now when the record is retreived and it is null then how to handle it. I mean the case when record.retrieve is successful but the record is null in that case the error is not thrown. bewlow is my code

        if(objModel){
              objModel.retrieve({ where: { Id: { eq: urlObject.aid}} }, loadRecordType);
          }
      }

      function loadRecordType(error,records,event){
            if(err){

   }

In above function how can I check that the records given are null?

1

There's no such thing as a "null record," so I presume you meant to say "when no records are returned," which looks like:

if(error) {
    display(error)
} else if(records.length) {
    render(records)
} else {
    // no records found, but no error occurred
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.