Skip to content

Instantly share code, notes, and snippets.

@wendelicious
Created December 20, 2013 02:12
Show Gist options
  • Save wendelicious/8049480 to your computer and use it in GitHub Desktop.
Save wendelicious/8049480 to your computer and use it in GitHub Desktop.
public Contact createContact(){
Model.Builder<Contact> contactBuilder = new Model.Builder<Contact>()
.setFieldValue(Contact.Field.FirstName, "first name")
.setCustomFieldValue("FavoriteDessert", "lemon cake")
.setFieldValue(Contact.Field.LastName, "last name");
return contactBuilder.build();
}
public void addContact(YailClient client, Contact contact) throws InfusionsoftXmlRpcException, InfusionsoftParameterValidationException {
ContactServiceAddOperation addContact = new ContactServiceAddOperation(contact);
client.call(addContact);
}
public void updateContact(YailClient client, Contact contact) throws InfusionsoftXmlRpcException, InfusionsoftParameterValidationException {
final Integer id = contact.getFieldValue(Contact.Field.Id);
DataServiceUpdateOperation updateContact = new DataServiceUpdateOperation(id, contact);
client.call(updateContact);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment