This is a public Forum  publicRSS


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

    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
    $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 = "";   
    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.



    • 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.