Method Community

 

FullName not being generated upon API insert

Last post 12-06-2017 8:25 PM by GroGreen. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 11-25-2017 11:38 PM

    FullName not being generated upon API insert

    Hey all, 

    Using arrowplane's code from here: https://gist.github.com/relish27/67432c710f4b4904ca6f

    Everything works ok, however the FullName field is not being generated. It is my understanding that FullName is generated by Method. If I try to add FullName to the insert I get the response: 'The field FullName does not support add.'

    Any ideas?

  • 11-26-2017 1:18 PM In reply to

    • Method_Jim
    • Top 100 Contributor
    • Joined on 09-29-2014
    • Toronto, Method HQ
    • Posts 45

    Re: FullName not being generated upon API insert

    Hi GroGreen,

    The API should be taking the Name field provided in the code and generating the FullName. Can you please pass the code that you used to pass to Method originally and the account that this is in so that we can have a look?

    Best,

    Jim

  • 11-26-2017 2:39 PM In reply to

    Re: FullName not being generated upon API insert

    Hi Jim, 

    Thanks for the reply. 

    The code is inserting 'Name'. When I look at the contact screen Name is there but FullName is blank. 

    I tried modifying the code to enter both Name and FullName but it won't allow an insert of the FullName field. 

  • 11-28-2017 12:48 PM In reply to

    Re: FullName not being generated upon API insert

    I haven't reviewed the code you provide but I suspect I know what is happening.  There is a bit of business logic that needs to be included to make Contacts work properly.  In short, Contacts should (must) always be associated to a Customer.  However, the API does not prevent you from creating a Contact without associating it to a Customer (because technically it is not required, but it is required to make Method business logic work correctly).  The mechanism to associate a Contact to a Customer is to include the Customer as the Entity for the Contact.  Entity is actually the parent table/object to Customer.  If you do this the business logic will execute correctly and the FullName field will be generated (and a few other fields) automatically.

    This is discussed in more detail in another post here (with a snipet of sample code): https://www.method.me/cs/forums/p/9709/35424.aspx#35424 .  

    Let us know if that helps.


    Peter Dyer
    Product Manager - Method
  • 11-28-2017 3:04 PM In reply to

    Re: FullName not being generated upon API insert

    I should have reviewed your code before responding.  My read of your code is that the Contact section is creating the problem and should not be executed.  When you create the Customer you are creating the first Contact for that Customer automatically.  You do not need to execute the Contact section of your code (everything inside the if($RecordID) block), and in fact, you will end up creating new a new Contact that is not associated to a Customer (that is bad).  If you query the contacts table for all records you should see the issue.  Let me know if that doesn't make sense.  

    Peter Dyer
    Product Manager - Method
  • 11-28-2017 3:29 PM In reply to

    Re: FullName not being generated upon API insert

    Hi Peter,

    Thanks for the reply. I tried deleting the Contact portion of the code, however FullName is still not being interted. I see FirstName, LastName and Name, but FullName is blank when looking at the customer.

  • 11-28-2017 4:07 PM In reply to

    Re: FullName not being generated upon API insert

    I'm going to reach out to you directly.  

    Peter Dyer
    Product Manager - Method
  • 12-06-2017 11:55 AM In reply to

    Re: FullName not being generated upon API insert

    As part of troubleshooting this ticket we generated a quick PHP sample - see here: https://www.method.me/api/ (right hand side, bottom).

    Peter Dyer
    Product Manager - Method
  • 12-06-2017 8:25 PM In reply to

    Re: FullName not being generated upon API insert

    Awesome!! Thank you!!

Page 1 of 1 (9 items)