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, ...
Suggested Answer

Delete records from Datasource

(0) ShareShare
ReportReport
Posted on by 63
Hello everyone, I am trying to delete data from SalesParmTable on SalesEditLines. The problem is that when I do so, I get the confirm deletion notification and the user needs to press Yes to confirm.
I am not sure if there is a way to bypass that.
here is my code.
void chooseTable(boolean _checkForReArrange)    {               next chooseTable(_checkForReArrange);                        SalesParmTable      salesParmTableFromDataSource = salesParmTable_ds.cursor() ;        SalesParmTable      salesParmTableFromTable;        CustParameters      custParameters = CustParameters::find();        if (custParameters.xxPendingSalesInvoice == NoYes::Yes && salesFormLetter.parmCreateFromHistory() == false )        {                        while (salesParmTableFromDataSource)            {                                //salesParmTableFromDataSource =salesParmTable_ds.cursor();                while select  salesParmTableFromTable                    where salesParmTableFromTable.SalesId == salesParmTableFromDataSource.SalesId                                 {                    if (salesParmTableFromTable.xxProFormaInvoice && salesParmTableFromTable.ParmJobStatus == ParmJobStatus::Waiting)                    {                                                ttsbegin;                                                salesParmTable_ds.delete();                                                                        ttscommit;                        warning(strFmt(/a pending invoice already exist for %1 /,salesParmTableFromTable.SalesId));                                                break;                    }                                }                               salesParmTableFromDataSource = salesParmTable_ds.getNext() ;                salesParmTable_ds.next();            }        }    }​
 
I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    239,451 Most Valuable Professional on at
    If you want to silently delete records from code, use delete() on a table buffer instead of the one one data source (salesParmTable_ds.delete()). By the way, it's strange that fetch records in the while select loop, but then you delete a different record. If you want to delete the records fetched by the while select, use salesParmTableFromTable.delete(), because salesParmTableFromTable is what you get from the query. If you want to delete the current record of salesParmTable_ds, you can simply use salesParmTable.delete(). By the way, it's usually a good idea to check whether a record can be deleted (validateDelete()) before actually doing it.
     
    If you want to use your current approach, user options allow configuring for which types of tables is this confirmation displayed.

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 April Top 10 Community Leaders

These are the community rock stars!

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

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 608

#2
André Arnaud de Calavon Profile Picture

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

#3
CP04-islander Profile Picture

CP04-islander 430

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans