Skip to main content

Notifications

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

How to assign values to custom fields based on a standard field available in the same table

(0) ShareShare
ReportReport
Posted on by 170

Hi There,

I have a requirement that I need to add some custom fields in SMMActivities form and already in the activities form there is some data for the standard fields available, I need to add these custom fields and update the custom field data according to available data.

So I have added custom fields in smm activities table and I'm not getting which method or event handler I need to take. I have tried with init method extension of smm activities form but unable to get the current smmactivities record because i need smm activity number to update custom fields. Please help me to achieve this.

  • Suggested answer
    Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: How to assign values to custom fields based on a standard field available in the same table

    Hi, If this is one time activity then I would suggest to create a runnable class and write logic to update all records. If the logic is simple then you can write SQL query and save time of code deployments.

    However, if your requirement is to populate values of the custom fields always based on existing data then table method initvalue as suggested by Bharani. If not works then please provide need more details of the requirement

  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,587 Super User 2024 Season 1 on at
    RE: How to assign values to custom fields based on a standard field available in the same table

    At table you have initValue method. Init is for forms.

    Yes to assign a default value you can write code at initvalue of the table. But kindly check if these default values should reflect on all forms where this table is used.

  • Ganesh Potnuru Profile Picture
    Ganesh Potnuru 170 on at
    RE: How to assign values to custom fields based on a standard field available in the same table

    Hi Bharani,

    Thanks for the suggestion.

    Need one more clarification, if I want to assign some values to these custom fields I can write code in table level init() method right? So that next time if I create a new record, data will insert in these fields right?

  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,587 Super User 2024 Season 1 on at
    RE: How to assign values to custom fields based on a standard field available in the same table

    So that means you have added few custom field in a standard table and you need to update it based on the already present data. Then you need to write some custom batch job to update these records. Else if you have an entity and Excel file with required data, you can use that to update these fields.

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

Announcing Our 2025 Season 1 Super Users!

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

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,969 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,842 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans