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();            }        }    }​
 
  • Suggested answer
    Martin Dráb Profile Picture
    240,744 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

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

#1
Martin Dráb Profile Picture

Martin Dráb 426 Most Valuable Professional

#2
CU10121822-0 Profile Picture

CU10121822-0 358

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 353 Super User 2026 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans