Solved

Dynamics AX :: Bill of Lading when Sales Order is Posted

Posted on 2008-10-07
13
2,104 Views
Last Modified: 2012-05-05
Dear Experts,

I need to produce a Bill of Lading when a Sales Order is posted.
As you should know by now that I am really new to AX development and would like some advise on how to accomplish this. Where will the code be, on which event?

Thanks!
0
Comment
Question by:Marius0188
  • 8
  • 5
13 Comments
 
LVL 4

Expert Comment

by:Maxi84
ID: 22666801
If you want to produce it when the invoice is posted, put the code in SalesFormLetter_Invoice.UpdateNow().  Similarly, for picking list posting, use SalesFormLetter_PickingList.UpdateNow() etc.
0
 

Author Comment

by:Marius0188
ID: 22668616
Hi thanks for the quick reply.

Can you please give some more help and advise.
Will I have to generate the report in X++ code?
or AutoDesignSpec / GeneratedDesign?

Where will I have to start.
Most of the fiels on the Sales Invoice can be used just as is for the Bill of Lading.

0
 

Author Comment

by:Marius0188
ID: 22668816
Is there a way that you build a AutoDesignSpec report and then simply execute the report from X++ code.

What I was thinking was to basically design the report the normal easy (hope so) way and then just call the report from X++ code...
0
 

Author Comment

by:Marius0188
ID: 22676308
Hi can someone please assist.
What is the best approach to start this project?
Please advise.

Thanks.
0
 
LVL 4

Expert Comment

by:Maxi84
ID: 22676577
Use, and modify as necessary, an existing report, or create your own in the AOT.  If you create your own report, add a new output-type menu item that calls your report.  If not, find the menu item that calls the existing report.

Add the following code to the method that you need to call your report from:

    MenuFunction mf = new MenuFunction(menuItemOutputStr(/*Menu item name goes here*/), MenuItemType::Output);
    Args args = new Args();
    ;
    //add args as necessary...
    mf.run(args);

You should use the tables CustInvoiceJour and CustInvoiceTrans to generate the bill of lading, and especially use the delivery and invoice name and addresses from CustInvoiceJour.  The point here is that these tables are a snapshot of what is actually delivered and invoiced.  The SalesTable and SalesLine may have items that are backordered, out of stock etc.  Also, the customer's name and address may change at any time after the order is shipoped, so if you use CustTable to retrieve the name and address, you will not be able to go back and generate an exact copy later if/when this becomes necessary.  There may also be legal issues WRT this.
0
 

Author Comment

by:Marius0188
ID: 22678599
Hi Maxi84,

I receive the following compiler error: "The operand for the function is not an element."
On line:
 MenuFunction mf = new MenuFunction(menuItemOutputStr(/*Menu item name goes here*/), MenuItemType::Output);

I have replaced the comment with the actual Report name.
Please advise
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:Marius0188
ID: 22678821
The first param for MenuFunction(), is this the Name property for the report menu item?
Should you write in in single / double quotes?

0
 

Author Comment

by:Marius0188
ID: 22684594
Hi Experts,

Please someone assist me.

The following code compiles well but I get a runtime error when running the job:
Please see attached screenshot for the error.

Please advise...
static void Execute_Report2(Args _args)

{

    Args            args;

    ReportRun       reportRun;
 

    ;
 

    args = new Args();

    reportRun = new MenuFunction(ReportStr(MyReports), 

       MenuItemType::Output).create(Args);

    reportRun.run();

}

Open in new window

AX-Error.jpg
0
 
LVL 4

Expert Comment

by:Maxi84
ID: 22684873
Don't use the report name.  As I wrote, create a new menu item in the AOS:  AOS/Menu Items/Output.  Right click on the Output node and select [New  menu item].  Set the 'Object type' to 'Report', and 'Object' to the name of your report.  Then use the name of your new menu item as the argument for menuItemOutputStr()
0
 

Author Comment

by:Marius0188
ID: 22684937
That is what I did at first.
But in the Job I used to make the call to the menu item I receive a compiler error:

"The operand for the function is not an element."

The line the error occurrs on is:
"menuFunction = new MenuFunction(MenuItemOutputStr(MvT_MenuItem), MenuItemType::Output);"
0
 
LVL 4

Accepted Solution

by:
Maxi84 earned 500 total points
ID: 22684980
If you want to call the report directly, without going through a menu item, this code sample calls the 'Cust' report.

    Args       args = new Args();
    ReportRun  reportRun;
    ;

    args.name(reportstr(Cust));

    reportRun = classfactory.reportRunClass(args);
    reportRun.run();

0
 

Author Comment

by:Marius0188
ID: 22685208
Ok, thanks.
That last example of yours worked.

But I am still curious why the example which calls a MenuItem did not want to work?
I have created the menu item, set the object and output.
But like I said the compiler error I received....

Thanks a million!
0
 
LVL 4

Expert Comment

by:Maxi84
ID: 22685894
Dunno, misspelling of the menu item name perhaps?
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Moving Cash Receipts from One Checkbook ID to Another 2 46
MS Dynamics Partnership 2 64
Dynamics CRM 2016 as a Help Desk Ticketing System 5 1,873
crm 2016 on cloud 5 82
This is a walkthrough guide I wrote whilst upgrading my on-premise MS Dynamics CRM 3.0 deployment to 4.0. This covers the actual installation of the product to a working level for my system, I ran into a lot of issues that the steps below fixed so h…
For cloud, the “train has left the station” and in the Microsoft ERP & CRM world, that means the next generation of enterprise software from Microsoft is here: Dynamics 365 is Microsoft’s new integrated business solution that unifies CRM and ERP fun…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now