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

Notifications

Announcements

No record found.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Martin Dráb Profile Picture

Martin Dráb 700 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 567 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 408 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans