Skip to main content

Notifications

Community site session details

Community site session details

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

a

(0) ShareShare
ReportReport
Posted on by 4

a

Categories:
  • hfou Profile Picture
    4 on at
    RE: Copy field into another one

    Thanks, that's what I needed to know! :)

    marked as Verified, thank.

  • Suggested answer
    Gunjan Bhattachayya Profile Picture
    35,421 on at
    RE: Copy field into another one

    Hi Fachuh,

    I assumed you were working with a custom table and not a standard one. In case of standard tables, you have to create a CoC on the standard methods  insert, update, modifiedField etc.), since you can't make any changes to standard code. You can learn more about CoC from this link.

    For custom tables, you have the option to override methods. That's where super call is made.

    In case your issue is resolved, please mark the useful answer(s) as Verified. It's done by Did this answer your question? > Yes in the reply.

  • hfou Profile Picture
    4 on at
    RE: Copy field into another one

    Hi Gunjan,

    thanks, it works for me when I use that code with next modifiedField(_fieldId), instead of super(_fieldId).

    I am just not sure what is the difference, why there can not be used super(_fieldId)? And is it possible to use events for this task? Because I was told to solve this by event.

    Sorry if it is stupid question, I am working in x++ for a few weeks only.

  • Verified answer
    Gunjan Bhattachayya Profile Picture
    35,421 on at
    RE: Copy field into another one

    Hi Fachuh,

    In that case, it will be best to override modifiedField method in the table and assign the value to Field "B" when Field "A" is modified.

    public void modifiedField(FieldId _fieldId)
    {
        super(_fieldId);
    
        switch (_fieldId)
        {
            case fieldNum(Table, FieldA) :
                this.FieldB = this.FieldA;
                break;
        }
    }

    For an example, you can check CustTable\modifiedField method.

  • hfou Profile Picture
    4 on at
    RE: Copy field into another one

    Hi Gunjan,

    they are both on the same data source(table) of the form.

  • Gunjan Bhattachayya Profile Picture
    35,421 on at
    RE: Copy field into another one

    Hi Fachuh,

    Are both of these fields in the same table? Or are they string controls on your form not bound to a data source?

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,289 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,068 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans