web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Post packing slip for shipment by X++ code, in AX2012

(0) ShareShare
ReportReport
Posted on by 100

Hi,

could somebody please help with post packing slip for shipment by x++ code?

I have job to test:

 

 

 

static void my_testPosting(Args _args)
{
    SalesFormLetter salesFormLetter;
    WMSShipment shipment;
    WMSShipmentId shipmentId =
'008431_113'
;
    ;

    salesFormLetter = SalesFormLetter_PackingSlip::newPackingSlip();
    salesFormLetter.allowEmptyTable(salesFormLetter.initAllowEmptyTable(
true
));
    salesFormLetter.multiForm(
true
);
    salesFormLetter.getLast();
    shipment = WMSShipment::find(shipmentId);
    SalesFormletter.update(shipment,
systemDateGet
(), SalesUpdate::PickingList, AccountOrder::None, false, true);
}

When I pass in the update call with salesTable, everything was fine.

But when I pass in WMSShipment, and set breakpoint on FormLetterParmData.DoChooseLines(), i found that variable chooseLines (a sysQueryRun) is simply as same as QueryStr(SalesUpdate), has no criteria on shipment Id at all. Therefore, instead of posting packing slip for one specified shipment, this job is trying to post ALL sales orders that have status equal to 2 (Delivered?) or 13 (ToBePicked).

I tested this in Standard AX with demo data. Both Kernel and application version are 6.0.947.280.

Could someone please tell me if I can use the salesFormLetter.update to post packing slip per shipment and how? or is this a known issue?

Any help will be highly appreciated.

Mei Yuan

 

 

*This post is locked for comments

I have the same question (0)
  • Dong Shen Profile Picture
    380 on at

    Posting all sales orders is the default behavior of FormLetterParmData.DoChooseLines().

    What you can do in your case is to specify your shipment in SalesParmTable before posing it.

    In a similar case, I'm able to automate partial packing-slip postings among multiple sales orders into one consolidated customer invoice.

  • Community Member Profile Picture
    on at

    Hi Mei Yuan,

    Were you able to solve this issue? I am facing the exact same problem and can't find any solution. Please let me know if you found a way to do this.

    Thanks,

    Charu Jadhav

  • Community Member Profile Picture
    on at

    Hi Dong,

    Could you please elaborate on "in your case is to specify your shipment in SalesParmTable before posing it". I'm not completely familiar with AX. If you could tell me what I need to do here, that would be greatly appreciated.

    Thanks,

    Charu jadhav

  • Christopher Jones Profile Picture
    30 on at

    You should be able to add the following:

    /*In declarations*/

    Set wmsShipmentSet = new Set(Types::String);

    /*prior to call to SalesFormLetter.update*/

    wmsShipmentSet.add(shipmentId);

    SalesFormLetter.parmLineIdSet(wmsShipmentSet.pack());

  • Community Member Profile Picture
    on at

    Hi Christopher,

    I actually already tried that. But doing this causes it to create separate packing slips for each sales order part of the wmsshipment (as opposed to post ALL sales orders).

    Still cannot get it to cretae one consolidated packing slip for all the sales orders and lines int hat wmsshipment.

    Charu

  • Suggested answer
    Vetri Profile Picture
    80 on at

    Try below code. This works for me

     loadTable = _args.record() as WHSLoadTable;
        shipmentTable = WHSShipmentTable::findByLoadId(loadTable.LoadId);
        salesFormLetter = SalesFormLetter_PackingSlip::newPackingSlip();
        salesFormLetter.allowEmptyTable(salesFormLetter.initAllowEmptyTable(true));
        salesFormLetter.multiForm(true);
        salesFormLetter.getLast();
        SalesFormletter.parmShipmentId(shipmentTable.ShipmentId);
        SalesFormletter.parmWHSLoadId(loadTable.LoadId);
        SalesFormletter.update(loadTable, shipConfirmDate, SalesUpdate::PickingList, AccountOrder::None, false, false);

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 21

#2
dserp Profile Picture

dserp 4

#2
dekion Profile Picture

dekion 4

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans