automatically email posted invoices

Navision Articles

Get our Free Newletter

Don't you have the time to be online here at DUG every day? So how do you follow what is going on in the Dynamics industry and community?
If you subscribe to the DUG Newsletter then you can relax! We will make sure that you don't miss the big news!

Check out our
Newsletter Subscription Center
page a complete list of our different newsletters.

Solution (Not Verified) This post has 0 verified solutions | 13 Replies | 4 Followers

Not Ranked
Male
33 Posts
525 Points
Joined: Nov 8, 2006
Last Online:
Nov 30, 2009 14:32
Mike1 posted on Jul 1, 2009 14:23
How helpful was this post/question? Please rate here:

Hello all,

A customer of mine wants to automatically send salesinvoices when they are posted.

Personally I was thinking of adding a functionality in the button "Functions"  in the sales invoice, something like "Post and email". Where the emailadress should be taken from the customercard for the customer that is used in the sales invoice header.

Too bad I am not a developer, so if someone could tell me if this is possible, and, more important, how to do it, I would be very Big Smile.

Btw they are working with 4.0

Man who scratch ass should not bite fingernails.....

All Replies

Top 25 Contributor
Male
1,045 Posts
21,919 Points
Joined: Dec 6, 2005
Last Online:
Mar 20, 2010 0:27
Location: Riga, Latvia, EU
Moderator
Modris Ivans replied on Jul 1, 2009 15:12
How helpful was this comment/solution? Please rate here:

Mike,

Simple way is Print Preview the Sales Invoice, while Preview is open, File / Send / Send Report by Email...

Navision will throw a HTML-formatted SI in New Mail window for you to choose adresee.

BUT:
it is not automatic;
HTML representation of SI report (and any other) is rather poor.

Any other solution needs (some) coding.

 

Modris Ivans
MCP-Dynamics NAV Application

Please specify in your posts
1.product and DB version;
2.locale, or use International Forums

"Verify Solution" to post that helped you solve your problem

Not Ranked
Male
33 Posts
525 Points
Joined: Nov 8, 2006
Last Online:
Nov 30, 2009 14:32
Mike1 replied on Jul 1, 2009 15:39
How helpful was this comment/solution? Please rate here:

Hi Modris,

Thank you for your reply. Unfortunately, the way you mentioned is one I already thought of, but is not the way my client wants.

What they want is to add another function to the "Post"button, called "Post & Send", for example. This should trigger a codeunit, or a batchreport, don't know which one, though.

This report/CU should take the emailadress as stated on the customercard, belonging to the customer in the sales header, open outlook, take the correct email adress, merge the invoice in the mail, and send it. And that for a number of invoices.

Best would also be to have a message that states "x out of y invoices have been sent."

Regards,

 

Mike

Man who scratch ass should not bite fingernails.....
Top 25 Contributor
Male
1,045 Posts
21,919 Points
Joined: Dec 6, 2005
Last Online:
Mar 20, 2010 0:27
Location: Riga, Latvia, EU
Moderator
Modris Ivans replied on Jul 1, 2009 23:40
How helpful was this comment/solution? Please rate here:

Mike1:
Best would also be to have a message that states "x out of y invoices have been sent."

This one goes in conflict with

Mike1:
add another function to the "Post"button, called "Post & Send",

because the last applies to ONE invoice (no need for message "x of y"), but first is applicable to "batch posting" of several Invoices.

Then you may suggest different approach - after posting a bunch of SI -- or every hour / every evening etc -- you run a Batch Job, which emails them all at once, previously you set some filters like Posting Date or SI number from-to, whatsoever.

This needs some coding, but, as I wrote, biggest problem here is not coding, but creating image of SI to send. Try the simple scenario and look at the HTML result - it differs dramatically from printed SI. One suggestion here - "print to PDF", and send the PDF.

It can be done, but real C/AL coding goes beyond my competence - so I'll move this thread to Developers forum - noone is capable to read all threads here, and there it will get Developers attention sooner.

Modris Ivans
MCP-Dynamics NAV Application

Please specify in your posts
1.product and DB version;
2.locale, or use International Forums

"Verify Solution" to post that helped you solve your problem

Not Ranked
Male
33 Posts
525 Points
Joined: Nov 8, 2006
Last Online:
Nov 30, 2009 14:32
Mike1 replied on Jul 2, 2009 10:32
How helpful was this comment/solution? Please rate here:

Hi Modris,

 

You are correct, it seems like I am talking about two different things, the Posting of 1 invoice and the batch posting of several invoices.

In the current situation I am talking about batchposting. My client posts, twice a month, several thousands of SI's..........

So, you can imagine you do not want to post them one at a time..........Hmm

Man who scratch ass should not bite fingernails.....
Top 500 Contributor
Male
66 Posts
870 Points
Joined: Apr 10, 2006
Last Online:
Mar 15, 2010 13:24
Location: India
Solution (Not Verified) Amol replied on Jul 2, 2009 12:28
How helpful was this comment/solution? Please rate here:
Suggested by Modris Ivans

Hi,

You can use Automation object of Microsoft OutLook

Or else you can use Codeuint 397 Mail .But prior to that you need to Save the SI in .pdf format and then attached that to your mail.

It will solve your problem.

Thanks

Amol

 

 

 

Amol
Microsoft Certified Business Management Solution Professional -Developer for Nav

Top 200 Contributor
Male
116 Posts
2,125 Points
Joined: Jul 19, 2007
Last Online:
Mar 20, 2010 4:35
Location: Jogjakarta
Joe Marselo replied on Jul 3, 2009 10:29
How helpful was this comment/solution? Please rate here:

Amol:
Hi,
You can use Automation object of Microsoft OutLook
Or else you can use Codeuint 397 Mail .But prior to that you need to Save the SI in .pdf format and then attached that to your mail.
It will solve your problem.

Thanks
Amol

May I ask an example for the codes if we use ms outlook automation object?

also, can you brief the steps need to be done on using cu397?

I'm trying to do such thing but still not successful to automate.

Thank you.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Kind regards, Joe Marselo

Top 500 Contributor
Male
66 Posts
870 Points
Joined: Apr 10, 2006
Last Online:
Mar 15, 2010 13:24
Location: India
Solution (Not Verified) Amol replied on Jul 3, 2009 10:44
How helpful was this comment/solution? Please rate here:
Suggested by Joe Marselo

Create one variable for 397 Codeunit

Pass the parameter as follows


Variablename = Newmessage(To,CC,Subject,Body,Attachfilename,opendialog)

Hope this will solve your problem

 

Amol
Microsoft Certified Business Management Solution Professional -Developer for Nav

Top 200 Contributor
Male
116 Posts
2,125 Points
Joined: Jul 19, 2007
Last Online:
Mar 20, 2010 4:35
Location: Jogjakarta
Joe Marselo replied on Jul 6, 2009 3:24
How helpful was this comment/solution? Please rate here:

Amol, ... thank you for the briefing.
i'll test it and get back to this forum soon.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Kind regards, Joe Marselo

Top 200 Contributor
Male
116 Posts
2,125 Points
Joined: Jul 19, 2007
Last Online:
Mar 20, 2010 4:35
Location: Jogjakarta
Joe Marselo replied on Jul 7, 2009 9:04
How helpful was this comment/solution? Please rate here:

it works.
but i'm stuck on 1 thing. i tried to use: format(variables+'\') and such as, in order to create new line. but it fails.

can i ask how to force a new line for the message body.
i prepare 'emlbody' as text 1024 for email body, and harversting emlbody += format(record.field+'\') from all over the sections.

thank you.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Kind regards, Joe Marselo

Top 50 Contributor
Male
594 Posts
7,665 Points
Joined: Oct 26, 2000
Last Online:
Mar 18, 2010 12:49
Location: Faroe Islands
Anfinnur replied on Jul 8, 2009 10:45
How helpful was this comment/solution? Please rate here:

Amol:

Automation object of Microsoft OutLook

Or else you can use Codeuint 397 Mail

(I guess you are using a NAV prior to NAV 5)
 When using Outlook you'll probably will be asked to confirm "...allow another program to use Outlook...", and if you are sending say 100 documents you have to press "Yes" 100 times. Yes - you can make some changes in the Registry to avoid this - but don't do that!

It's possible to use SMTP-mail which is used in NAV 5.

I tried to copy theese objects from NAV 5 till NAV 3.60: Codeunit 400 (SMTP Mail), table 409 (SMTP Mail Setup) and form 409 (SMTP Mail Setup) - and after a setup on the Exchange-server mail is sent directly via Exchange and not Outlook.

Using SMTP causes that you will not se in your Outlook that you have sent a mail; solution is to send a CC- og BC-mail to yourself.

Top 200 Contributor
Male
116 Posts
2,125 Points
Joined: Jul 19, 2007
Last Online:
Mar 20, 2010 4:35
Location: Jogjakarta
Joe Marselo replied on Jul 9, 2009 9:09
How helpful was this comment/solution? Please rate here:

amol, thank you for your help so far.
i think i didnot make myself clear with my question - sorry -, so, i would rephrase it:

with cu397, i assigned text into an 'emltx' variable - text - 1024.
i do like this:
emltx := 'Customer :' + customer"name + ' \' ;
emltx += 'Address : '+ customer."address 1" + ' \';
emltx +=  customer.city;

with codes like this, if i output it to a text box (either in form, report or message) - with TextBox - SourceExpr:emltx;
it will give us result like this:
Customer : Some Customer
Address : Any Street
CertainCity

but if i use: emltx := Newmessage(To,CC,Subject, emltx , Attachfilename, opendialog); as a result, an ms outlook new email appear; To., CC, Subject are correct - but - the message body appear like:
Customer : Some Customer\Address :Any Street\CertainCity

obviously this is not the format i want to see in the email body. i need NAV to process'\' sign as a new line command. how to make or force a new line to appear in the email body?

I thank you very much for the feedback you've given.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Kind regards, Joe Marselo

Top 200 Contributor
Male
116 Posts
2,125 Points
Joined: Jul 19, 2007
Last Online:
Mar 20, 2010 4:35
Location: Jogjakarta
Joe Marselo replied on Jul 14, 2009 4:30
How helpful was this comment/solution? Please rate here:

i'm awaiting anyone to help me with this, please.
thank you.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Kind regards, Joe Marselo

Top 50 Contributor
Male
516 Posts
9,940 Points
Joined: Sep 10, 2001
Last Online:
Jan 25, 2010 11:44
Location: Copenhagen, Denmark
Moderator
Sponsor
Alexander Pallesen replied on Jul 14, 2009 13:41
How helpful was this comment/solution? Please rate here:

Hi Mike,

Did you figure this one out?

A friend of mine created something a while ago, that uses the SMTP-server (no need for accepting use of outlook).
He made it in a way so user just prints invoices just as usual.
Then during the printout, NAV determines whether or not the particular customer wants their invoices through mail which would cause a pdf-file to be created, and mailed to the customer, or they want an oldschool paper invoice by snail-mail which would cause the invoice to print as normal. 

I've never looked into what he created, but i remember he told me that all you need is to add a few lines of code in the existing sales invoice report.
(besides implementing a number of other objects he made, do some needed setup, and installing the automation to create the pdf locally)

If you want me to, i can contact him to hear if he still has that thingey lying around?

 

Regards,

Alexander Pallesen
Freelance Navision Developer

Please:
1. Use a meaningful title.
2. Give as much detail as possible.
3."Verify Solution" to the post that help you solve your problem.
4. Fill out your tags - it will help other people.
5. N.B. Don't be afraid to ask - we all had to learn and are still learning Wink

Page 1 of 1 (14 items) | Get this RSS feed | Bookmark and Share