Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

allow edit on particular record ( row).

Posted on by Microsoft Employee
hello everyone,

my requirement is when I pressed status update button in below form,
It should popup a dialog asking yes or no .
1. If I press yes the field status of book should updated as approved
and should freeze the row.
2. If I press no the field status of book should updated as rejected.





I wrote the following code, But it was freezing the whole table can anyone
help me solving the issue.




void clicked() { DialogButton dialogB; BooksDetail booksDetaillocal; dialogB = Box::yesNo( " Do You Want To Approve ", DialogButton::Yes, " Status Update ", " Press Yes to Approve "); if (dialogB == dialogButton::yes) { ttsBegin; select forupdate booksDetaillocal; { booksDetaillocal.StatusDetails = StatusDetails::Approved; booksDetaillocal.update(); } ttsCommit; BooksDetail_ds.allowedit(false); } else { BooksDetail_ds.allowedit(true); } super(); }


88218.1.PNG

*This post is locked for comments

  • Sohaib Cheema Profile Picture
    Sohaib Cheema 46,610 User Group Leader on at
    RE: allow edit on particular record ( row).

    you are also missing code in else part. in else part you should write code to update status to REJECT as per your description of problem.

    and as you have mentioned that its not updating status of field, you may change your code.

    e.g. you can write code as under

    BooksDetail.StatusDetails  = StatusDetails::Approved;

    BooksDetail.write();

    In your above code you are updating a new buffer which is not representing current record.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: allow edit on particular record ( row).

    I want to freeze a row not a column or table.

  • martinarul Profile Picture
    martinarul 217 on at
    RE: allow edit on particular record ( row).

    Hi Ravi

     You are using the code to freeze the entire data source and the that is the reason your whole table is getting freezed.  Try writing the code to disable only that particular field.

    Regards

    Martin. A

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: allow edit on particular record ( row).

    hi Sohaib,

    that was working fine but it is  not meeting my requirement.

    when I press Status Update Button yes it should update the status of book field to approved but I am not getting that.      

  • Verified answer
    Sohaib Cheema Profile Picture
    Sohaib Cheema 46,610 User Group Leader on at
    RE: allow edit on particular record ( row).

    Remove following 2 lines of code from your code

    BooksDetail_ds.allowedit(false);

    BooksDetail_ds.allowedit(true);

    And then add logic in active() method of BooksDetail(DataSource)

    if(BooksDetail.StatusDetails == StatusDetails::Approved)

    {

    BooksDetail_ds.allowedit(false);

    }

    else

    {

    BooksDetail_ds.allowedit(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,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans