Associating Job No. to Sales Order in NAV 5.0 SP1


We’re in the process of implementing order management in our company, using NAV 5.0 SP1. We started the “brainstorming” using NAV 4.0 SP1 and found that it was possible to associate Job Nos to Orders, both in the header and in every single line.
We upgraded to NAV 5.0 SP1 and we discovered that it’s now impossible to associate a Job No. to the header (the field is missing), while it seems possible to associate it to the lines (the “Job No.” field exists in the table). Two problems: first, the drop down to choose the Job looks uneditable although not set so. Second, there are some controls in the header which explicitly test that SalesLine.“Job No.” be blank.

Is there a way to associate single order lines to a job without changing/commenting heaps of C/AL code? And even changing lots of it? If not, can anyone figure the practical reason?

Thank you very much in advance!

Jobs in NAV 5.x have a complete different philosophy from previous versions.
Now jobs have a function to copy planning lines to invoices. Those lines in invoices must match planning lines. Using this structure, job field in header don’t have any purpose, so was removed.
If you want to use sales orders instead of sales invoice you should apply a patch from Microsoft. Originally in version 5.x only sales invoices were supported.

Thank you very much for your quick reply, it’s been very useful, but doesn’t actually solve our problem: perhaps jobs are no more the preferred solution for what we need to achieve, nonetheless the concept/possibility can’t have been removed… Or at least I hope!

If I wanted to get back to the old behaviour, where I could associate orders to jobs (or their substitutes), what should I do? That is, if I need to migrate a whole 4.0 system which is based on these assumptions, how can I achieve the same results as before?

As far as I understand, Microsoft’s patch to use orders instead of invoices lets you generate orders from jobs, but this is not what the old versions let you do: there you could generate orders on their own and eventually associate a job to them…

Any help is deeply appreciated…

Thanks in advance!

Before you making any decision you should take a NAV 5.0 jobs training or contact your local partner if you are a end customer.

I have already been in projects here customers decided that they wanted exactly the same behavior of projects in version 4.X in NAV 5.0 and they have followed customization way. I don’t recommend that way, it can be quite expensive. Other customers decided to use only dimensions concept to fulfill their needs.

I don’t know your business model so I can’t recommend a possible way to you.

First of all check out the recent update from MS - available on partner source - MicrosoftDynamicsNAV5.0SP1_JobsUpdate.exe.

This is not difficult at all. I’m new to NAV and was the first thing I wrote. We had some modules, obtained through a local MS promotion program, which allowed for sales invoices to be posted with a job number on the lines. The mods didn’t allow an order to have job numbers - so I set to work.

When you create an invoice from a job it inserts lines into the Sales Lines table and into the Job Planning table. There is a numeric field which is the link between the two.

When you create an invoice or an order directly you need to add some logic to insert the Job Planning lines. Its not complex.

The existing logic was only written to handle an invoice generated from a job - not an order and an order can be partially invoiced so you need an extra little logic to update the costs in the job planning table to reflect the updated ‘invoiced quantity’ of the sales line. Its not as difficult as you may think.

The 1001 and 1012 code units contain loads of lines like these:


which I had to change to

IF SalesLine.“Document Type” <> SalesLine.“Document Type”::Order THEN

In the middle of the 1001 code unitm function PostInvoiceContractLine I’ve added this:

// INTEGRA - IPM - Allow invoicing from Orders with Job No assigned
IF SalesLine.“Document Type” = SalesLine.“Document Type”::Order THEN
// As we gradually invoice an order, increase what has been booked against
// the job inline with the total amount invoiced
JobPlanningLine.Quantity := SalesLine.“Qty. to Invoice” + SalesLine.“Quantity Invoiced”;
JobPlanningLine.“Quantity (Base)” := JobPlanningLine.Quantity;
JobPlanningLine.“Unit Price (LCY)” := SalesLine.“Unit Price”;

JobPlanningLine.“Unit Price” := SalesLine.“Unit Price”;

JobPlanningLine.“Total Price” := JobPlanningLine.“Unit Price” * JobPlanningLine.Quantity;
JobPlanningLine.“Total Price (LCY)” := JobPlanningLine.“Unit Price (LCY)” * JobPlanningLine.Quantity;

JobPlanningLine.“Line Amount” := JobPlanningLine.“Unit Price” * JobPlanningLine.Quantity;
JobPlanningLine.“Line Amount (LCY)” := JobPlanningLine.“Unit Price (LCY)” * JobPlanningLine.Quantity;

JobPlanningLine.“Invoiced Amount (LCY)” := JobPlanningLine.“Line Amount”;

JobPlanningLine.“Total Cost (LCY)” := JobPlanningLine.“Unit Price (LCY)” * JobPlanningLine.Quantity;

There are a few more things you need to change but none of it is very difficult once you understand how it works.Sorry I can’t just post a fob but I don’t think I can publish the bits of code from the extension modules we recieved.

I also added a job number to the sales header and added code to just fill that number into each sales line.


Nuno was posting at the same time as I was typing. I hadn’t considered if you were an end user or partner, I assumed partner.

I definitely wouldn’t try to get the jobs module to behave like the previous version - it seems to work quite well so it would be best to use as much standard functionality as possible. The only downside is that they’ve left things half completed - like the inability to generate a Quote - have the quote accepted - set up a job - bill the quoted order against a job.

Also, as I mentioned above, this was my first attempt at nav programming - so it would be better to get an experienced nav programmer to start from scratch than to waste time with my code.

Thanks to all! Yes, I work for a partner, so imurphy assumed right! :smiley:

We don’t need the old behaviour anymore, we are still in a phase where we can refactor everything from the start, using the new NAV 5 “philosophy”. Thank you very much anyway!