ruckus / quickbooks-ruby

Quickbooks Online REST API V3 - Ruby
MIT License
374 stars 302 forks source link

Add BillEmailCc #531

Closed rentgratatech closed 3 years ago

rentgratatech commented 3 years ago

I'm looking for a way to add a BillEmailCc element to the invoice... It doesn't appear to be an available field on the invoice object. Can I add a custom element somehow until this option is supported?

Thanks!

Screen Shot 2020-10-06 at 8 09 17 PM
ruckus commented 3 years ago

Hi, I just pushed 1.0.13 with support for Invoice#BillEmailCc. Please give it a shot.

chibuezeayogu commented 3 years ago

Hey @ruckus, After this feature was added, we updated the gem and the email added under Account and Settings -> Sales -> Messages in Copy (Cc) new invoices to address column wasn't receiving email as usual when a new invoice is being created. I have tried to figure out what could be the cause but can't find anything.

Any pointers?

ruckus commented 3 years ago

Hi @chibuezeayogu perhaps those two fields are different things.

The Invoice#BillEmailCc documentation says:

Identifies the carbon copy e-mail address where the invoice is sent. If not specified, this field is populated from that defined in Preferences.SalesFormsPrefs.SalesEmailCc

How I interpret that is: you can specify up two email addresses on an invoice (BIllEmail, BillEmailCc) which will be sent when EmailStatus=NeedToSend (HOW you trigger QBO to actually send the email I am not sure).

So, you can insert some random email address in Invoice#BillEmailCc field or if left blank it will be pulled from your settings.

But you're saying that is happening but not actual email is being delivered? Yeah, I think its because we need to support the actual request of asking QBO to send the invoice email.

I just found some docs for this:

https://developer.intuit.com/app/developer/qbo/docs/api/accounting/most-commonly-used/invoice#send-an-invoice

I will need to look into this.

chibuezeayogu commented 3 years ago

@ruckus thanks for your response. So the email in Preferences.SalesFormsPrefs.SalesEmailCc was receiving newly created invoice before the update you add to include Invoice#BillEmailCc field.

I have some questions.

Note:: We are using invoice_service.send to send email to our customers.

ruckus commented 3 years ago

Hi @chibuezeayogu I don't think I totally understand your question(s).

Can we add more than one BillEmailCc in the Invoice#BillEmailCc field?

I dont know. I know in the QB UI when creating an Invoice you can comma-delimit multiple emails to send to. Perhaps this field also supports a comma-delimited list?

Is there a way to always send an email to the email

If you checkout the URL structure of the Invoice#Send operation:

invoice-send

It does support the specification of an arbitrary email address to send to. Which in turn is available as the 2nd argument to the invoice service send method.

https://github.com/ruckus/quickbooks-ruby/blob/master/lib/quickbooks/service/invoice.rb#L14

So, you should be able to do:

invoice_service.send(the_invoice, "foo@example.com")

to send it to an arbitrary email address that might or might not be in Preferences.SalesFormsPrefs.SalesEmailCc

chibuezeayogu commented 3 years ago

@ruckus This is what worked for me.

....
invoice.bill_email = Quickbooks::Model::EmailAddress.new("abc@mail.com")
# this is what I was asking if it is possible
# adding two email addresses on Invoice#BillEmailCc field.
invoice.bill_email_cc = Quickbooks::Model::EmailAddress.new("a@mail.com, b@mail.com") 
created_invoice = invoice_service.create(invoice)
invoice_service.send(created_invoice)

Thanks for your time and response.