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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

MultiSelect with update on a temporary table

(0) ShareShare
ReportReport
Posted on by 77

Hi,

I'm attempting a modification to the SalesCreateReleaseOrder form with the intention that a user can filter the order lines and then using a multiselect, ask AX to create a release order with the sales quantity automatically pulled from the corresponding sales line.

So far, I have added a new field to SalesCreateReleaseOrderLineTmp, the temporary table that the form uses as a datasource called SalesLineSalesQty, which carries the SalesQty from the corresponding SalesLine entry. I now want the user to select one or more records and then click a button. This would then copy the value from SalesCreateReleaseOrderLineTmp.SalesLineSalesQty into SalesCreateReleaseOrderLineTmp.SalesQty.

However, when attempting to do this, I get an error - 

Cannot edit a record in Order lines (SalesCreateReleaseOrderLineTmp).
The record has never been selected.

 

The code that I'm using (on the form button) is:

void clicked()
{
    MultiSelectionHelper            selectionHelper = MultiSelectionHelper::construct();
    SalesCreateReleaseOrderLineTmp  orderLineTmp;

    super();

    selectionHelper.parmDataSource(SalesCreateReleaseOrderLineTmp_ds);
    orderLineTmp  = selectionHelper.getFirst();

    while (orderLineTmp){
        ttsbegin;
        orderLineTmp.selectForUpdate(true);
        orderLineTmp.SalesQty = orderLineTmp.SalesLineSalesQty;
        orderLineTmp.update();
        ttscommit;
        orderLineTmp = selectionHelper.getNext();
    }

    SalesCreateReleaseOrderLineTmp_ds.reread();
    SalesCreateReleaseOrderLineTmp_ds.refresh();

}

Is anyone able to assist please?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Rustem Galiamov Profile Picture
    8,072 on at

    Hi Phil Matthews!

    That because you don't have any records in your orderLineTmp variable. Try to use setTmpData() method.

  • PhilMatthews Profile Picture
    77 on at

    Hi Rustem,

    That of course makes sense from the error that is given, but the setTmpData() method is called in the init method of the form and if I change my while loop to...

       while (orderLineTmp){
    
        info(orderLineTmp.itemid);
    
       }


    ...for example, it outputs all of the ItemId values of the records that I have selected.

    This is not a form that I have created, it is a form which already exists in AX2009 from stock.

    Regards,

    Phil

  • Verified answer
    PhilMatthews Profile Picture
    77 on at

    The following code works!

    void clicked()
    {
        MultiSelectionHelper            selectionHelper = MultiSelectionHelper::construct();
        SalesCreateReleaseOrderLineTmp  orderLineTmp, orderLineTmpLocal;
    
        super();
        selectionHelper.parmDataSource(SalesCreateReleaseOrderLineTmp_ds);
        orderLineTmp  = selectionHelper.getFirst();
    
        while (orderLineTmp){
            orderLineTmpLocal.data(orderLineTmp);
            orderLineTmpLocal.SalesQty = orderLineTmp.SalesLineSalesQty;
            orderLineTmpLocal.insert();
            orderLineTmp = selectionHelper.getNext();
        }
    
        SalesCreateReleaseOrderLineTmp.setTmpData(orderLineTmpLocal);
        SalesCreateReleaseOrderLineTmp_ds.executeQuery();
    
    }


    Regards,

    Phil

  • Rustem Galiamov Profile Picture
    8,072 on at

    So, why you're not setting SalesQty value when SalesCreateReleaseOrderLineTmp data was created in first time?

  • PhilMatthews Profile Picture
    77 on at

    Hi Rustem,

    Because this will release all of the lines on the blanket order. The user will be dealing with large blanket orders (500+ lines) and creating release orders for 50+ lines.

    The actual process that the user will do is:

    1) Create a release order from the blanket order.

    2) Filter the lines on the Create Release Order form by Customer Reference, and select them all.

    3) Click the button to fill in the Sales Quantity for all of the lines which have not been filtered out.

    4) Create the release order for these lines only.

    Thanks,

    Phil

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 39

#2
Michel ROY Profile Picture

Michel ROY 14

#3
imran ul haq Profile Picture

imran ul haq 8

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans