Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Associating a deal with a contact and company #19

Closed
kprock opened this issue May 12, 2018 · 2 comments
Closed

Associating a deal with a contact and company #19

kprock opened this issue May 12, 2018 · 2 comments

Comments

@kprock
Copy link

kprock commented May 12, 2018

Hi. This is a fantastic wrapper, so thank you. I am, however, trying to create a deal and associate it with a contact and company, but your deal model doesn’t allow me to add contact and company long[] arrays and assign them to the Associations property. Any assistance you could provide would be appreciated.

@clarkd
Copy link
Member

clarkd commented May 14, 2018

You should be able to associate a contact (or company) like this:

/**
 * Initialize the API with your API Key
 * You can find or generate this under Integrations -> HubSpot API key
 */
var api = new HubSpotApi("demo");

/**
 * Create a contact
 */
var contact = api.Contact.Create(new ContactHubSpotModel()
{
    Email = "john11@squaredup.com",
    FirstName = "John",
    LastName = "Smith",
    Phone = "00000 000000",
    Company = "Squared Up Ltd."
});

/**
 * Create a deal
 */
var deal = api.Deal.Create(new DealHubSpotModel()
{
    Amount = 10000,
    Name = "New Deal #1",
    Associations = { AssociatedContacts = new []{ contact.Id.Value }} //associate here!
});

Is that not working for you?

@kprock
Copy link
Author

kprock commented May 14, 2018

It's working perfectly now. Thanks so much for the help!

@clarkd clarkd closed this as completed May 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants