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 :
Finance | Project Operations, Human Resources, ...
Unanswered

How to delete a record while validating transfer order quantity

(0) ShareShare
ReportReport
Posted on by 170

Hi there,

I have a requirement that when i'm creating a transfer order and when i click on add in transfer line and selected a item, location,qunaitity will be 1 by defalut and i'm not changing it  and when i clicked on save it has to validate that 1 quantity is available in the repective warehouse location if it is there it has to do normal standard functionality if it is not available it has to prompt a dialog box with YES Cancel button if i click on cancel it has to delete that line from that transfer order. I have written a code but it is not deleting the line. Kindly, please help me on achieving this requirement and i have written coc on form data source validatewrite() method of inventtransferline formdatasorce.

    public boolean validateWrite()
    {
        boolean ret = true;

        next validateWrite();

        InventTransferLine inventTransferLine = this.cursor();
        InventTable    inventTable;
        InventTransferTable inventTransferTable;
        InventDim      inventDim;
        InventDimParm  invDimParm;
        Qty            availPhys;
        DialogButton   diagbut;

        select firstonly inventTable
                where inventTable.ItemId == inventTransferLine.ItemId
            join inventDim
                where inventDim.inventDimId == inventTransferLine.InventDimId
            join inventTransferTable
                where inventTransferTable.TransferId == inventTransferLine.TransferId;

        invDimParm.initFromInventDim(InventDim::find(inventDim.inventDimId));
        availPhys = InventSum::findSum(inventTransferLine.ItemId,inventDim,invDimParm).availPhysicalCalculated();

        if(inventTransferLine.QtyTransfer == 1 && availPhys == 0)
        {
            if(inventTable.customfield1 == NoYes::Yes)
            {
                diagbut = Box::okCancel(strFmt("@PG001004",inventTable.customfieldItemNumber),DialogButton::Cancel,"@SYS117647");
                if (diagbut == DialogButton::Ok)
                {
                    inventTransferLine.ItemId = inventTable.customfieldItemNumber;
                    ret = true;
                }
                else if (diagbut == DialogButton::Cancel)
                {
                    ttsbegin;
                    inventTransferLine.doDelete();
                    ttscommit;
                    //this.research(true);
                    this.refresh();
                    ret  = false;
                }
            }
        }
        return ret;
    }

I have the same question (0)
  • Mohit Rampal Profile Picture
    12,565 Moderator on at

    Hi, Does it even create a transfer line. I think you are trying to delete transfer order lines which is not yet created. How about preventing creation of line and throwing error that no enough quantity available.

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!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 558 Super User 2026 Season 1

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 402

#3
Diego Mancassola Profile Picture

Diego Mancassola 261

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans