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

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

When Button is clicked on Action Pane , fields become non editable and a field value changes to yes using x++

(0) ShareShare
ReportReport
Posted on by 2

pastedimage1682076923652v1.png

added a button post on form when post button is clicked all field should be non editable and is posted becomes yes

I have the same question (0)
  • Suggested answer
    GirishS Profile Picture
    27,827 Moderator on at
    RE: When Button is clicked on Action Pane , fields become non editable and a field value changes to yes using x++

    Hi Sachin Mittal,

    You can add your logic on the clicked method of the Post button. Make the DataSource editable or non-editable by adding code on active method of the DataSource using the field Posted status.

    public void clicked()
    {
        super();
        DataSourceName_ds.allowEdit(false);
        DataSourceName.PostStatus = PostStatus::Posted;
        DatasourceName_ds.research();
    }

    Thanks,

    Girish S.

  • Suggested answer
    Mohit Rampal Profile Picture
    12,565 Moderator on at
    RE: When Button is clicked on Action Pane , fields become non editable and a field value changes to yes using x++

    Hi Sachin, on clicked method of post, you can update Is posed field to yes and datasource.allowEdit to No.

    Override active method of datasource and allowEdit based on Is posted value. So if record is not posted, fields are editable. Also, if I may suggest, you can disable post button based on Is posted value.

    www.dynamicsuser.net/.../50020

  • Sachin Mittal Profile Picture
    2 on at
    RE: When Button is clicked on Action Pane , fields become non editable and a field value changes to yes using x++

    yes it should also be done , post button should be disables for posted ones , what can be code for that?

  • Verified answer
    GirishS Profile Picture
    27,827 Moderator on at
    RE: When Button is clicked on Action Pane , fields become non editable and a field value changes to yes using x++

    You can add your logic on the active method of the form datasource.

    public int active()
    {
        int ret;
        ret = super();
        if(DatasourceName.PostedStatus == PostedStatus::Posted)
        {
            DataSourceName_ds.allowEdit(false);
        }
        else
        {
           DataSourceName_ds.allowEdit(true); 
        }

    Thanks,

    Girish S.

  • Sachin Mittal Profile Picture
    2 on at
    RE: When Button is clicked on Action Pane , fields become non editable and a field value changes to yes using x++

    no it like , when enum value is yes , post button should also be disabled

  • Verified answer
    Mohit Rampal Profile Picture
    12,565 Moderator on at
    RE: When Button is clicked on Action Pane , fields become non editable and a field value changes to yes using x++

    For post button, you can set AutoDeclaration of button to yes and in active method use

    PostButton.enabled(true) or false in the same code where you are going to check if is posted is yes or No in the active method of form datasource as well in post clicked method.

  • Verified answer
    GirishS Profile Picture
    27,827 Moderator on at
    RE: When Button is clicked on Action Pane , fields become non editable and a field value changes to yes using x++

    You can set the auto declaration property of the Post button to Yes and add that control enable property to no or yes on the active method.

    public int active()
    {
        int ret;
        ret = super();
        if(DatasourceName.PostedStatus == PostedStatus::Posted)
        {
            DataSourceName_ds.allowEdit(false);
            PostButtonName.enabled(false);
        }
        else
        {
           DataSourceName_ds.allowEdit(true);
           PostButtonName.enabled(true);
        }
    }

    Thanks,

    Girish S.

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 683 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 398 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans