TypeError: Cannot read property "name" from undefined


#1

I keep getting the following message and I have NO clue why:

TypeError: Cannot read property “name” from undefined. (line 535, file “Code”)

Line 535 reads: var coverPageText = “Hi “+ contact.name +”,\r\n\r\n” + strBodyPlain;

The entire function code is as follows. Can anyone help?

function sendFax(contact, files,type,text)
{
  
  //var modContact = {name: 'John Doe', faxNum: '123456789'};
  //contact = modContact;
    var coverPageText = "Hi "+ contact.name +",\r\n\r\n" + strBodyPlain;  
  
    var attributes ="{\"to\":[{\"phoneNumber\": \""+ contact.faxNum +"\",\"name\":\" "+contact.name+"\"}],\"faxResolution\" : \"High\","
    + "\"coverIndex\": \"5\"";
    
    if(type=='invoice')
    {
      //attributes += "," + "\"coverPageText\": " + JSON.stringify(coverPageText)
      attributes = coverPageText;
    }
      else if (type=='summary')
      {
        //attributes += "," + "\"coverPageText\": " +

Thanks,
Stephen


#2

Those lines are comments. Try removing the //.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.