This is a public Forum  publicRSS

Topic

    wang jin
    can not save contact using php connect api
    Topic posted July 11, 2018 by wang jinRegular 
    40 Views, 1 Comment
    Title:
    can not save contact using php connect api
    Content:

    I want create a contact using php connect api, So I wrote code in customer portal as below :

    $contact = new RNCPHP\Contact();
    $contact->Title = ""; 
    //add email addresses
    $email_addr=$zykh."@com.invalid";
    $contact->Emails = new RNCPHP\EmailArray();
    $contact->Emails[0] = new RNCPHP\Email();
    $contact->Emails[0]->AddressType=new RNCPHP\NamedIDOptList(); 
    $contact->Emails[0]->AddressType->LookupName = "Email - Primary";
    $contact->Emails[0]->Address = "12345@com.com";   
    $contact->save();
     
    when the php run , it shows error message as below:
    Invalid ID:ID could not be resolved from the lookupName[Email - Primary];
     
    But the  php connect  api document wrote code like this,what's wrong with my code? Can you give me some suggestion?  thank you.
    Version:
    1

    Answer

     

    • Robert Surujbhan

      On your site, access the Message Bases editor (in Site Configuration) and search for the entry with the key EMAIL_PRIMARY_LBL.  The default text should be "Email - Primary" but yours was likely renamed for a customization.  Check the Custom Text value of this Message Base on your interface, and that's the value you need to use for the AddressType>LookupName in your code.