Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Suggested answer

How to fix "The operation cannot be completed, since the record was not selected for update. Remember TTSBEGIN/TTSCOMMIT as well as the FORUPDATE clause."

Posted on by 270

Here my scenario:

1st: Form A -> Click button -> Creates a new record and update the args.record() from Form A -> done (it is working here)
2nd: Form A -> Click button -> Form B -> Creates a new record and update the record from Form A using the record in Form B (record in Form A and Form B has connection) -> not working here

it uses the same class, there's just one more step on the 2nd scenario but it basically performs the same methods.

I searched everywhere for the fix for this, but I still get the error.

My code is below:

ttsBegin;
    
_wharfageSalesLine.selectForUpdate(true);
_wharfageSalesLine.RecordReference = 1;
    
if (!isLineDetailsAvailable)
{
    _wharfageSalesLine.FullyCredited   = NoYes::Yes;
}
    
_wharfageSalesLine.doUpdate();
        
ttscommit;

I performed debugging, the record Id is not blank. The record is recognized. But still it tells me that the record was not selected. 

  • Ludwig Reinhard Profile Picture
    Ludwig Reinhard Microsoft Employee on at
    RE: How to fix "The operation cannot be completed, since the record was not selected for update. Remember TTSBEGIN/TTSCOMMIT as well as the FORUPDATE clause."

    Good morning Miguel,

    Just wanted to follow up on this one and ask if you have been able to get the issue fixed based on the feedback provided.

    Can you also let us know whether this issue is related to D365FO or AX2012?

    Would be great if you could provide us with an update.

    Many thanks and best regards,

    Ludwig

  • WillWU Profile Picture
    WillWU 22,350 on at
    RE: How to fix "The operation cannot be completed, since the record was not selected for update. Remember TTSBEGIN/TTSCOMMIT as well as the FORUPDATE clause."

    Hi Miguel,

    Where is buffer for _wharfageSalesLine?

    It seems that you haven't selected any record, the selectForUpdate(true) method is used to set a property on the buffer, so that next time a select is performed the record is locked

    You have to add select statements after ttsbegin.

    docs.microsoft.com/.../xpp-data-query

  • Suggested answer
    Mea_ Profile Picture
    Mea_ 60,278 on at
    RE: How to fix "The operation cannot be completed, since the record was not selected for update. Remember TTSBEGIN/TTSCOMMIT as well as the FORUPDATE clause."

    add _wharfageSalesLine.reread(); after _wharfageSalesLine.selectForUpdate(true);

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans