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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

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

Set a default value in reference group control

(0) ShareShare
ReportReport
Posted on by 209

Hi Community experts,

I am want to set a default value in a reference group control.

I want to insert the logged in user's details here in this field

pastedimage1651323193717v1.png

To fetch the data I am using this query (mention in screenshot) and writing this code in OnInitialized DataSource event

pastedimage1651323289753v2.png

As soon as I click the new button the event gets triggered but nothing is getting populated in the field.

Looking forward to helpful responses on this.

Best Regards

I have the same question (0)
  • Verified answer
    Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi Ali,

    Do you want to set the logged in user's details in this field, or do you want to set the user creating the record in this field? If you want to set the logged in user's details, every time a user opens this form, the their details will be set on this form. This way you won't be able to check who actually is the requestor of the position action.

    Secondly, rather than setting the form control value, you should set the field value for the table. The field Originator in HcmActionState table has a foreign key relation with HcmWorker table. So, you need to find the HcmWorker record for the currently logged in user. Assuming that you want to set the Originator field when a new action is created, you can create a CoC on initValue method in HcmActionState table. Your code will look like this -

    [ExtensionOf(tableStr(HcmActionState))]
    final class HcmActionState_Extension
    {
    	public void initValue()
        {
            next initValue();
    		this.Originator = HcmWorkerLookup::currentWorker();
        }
    	
    }

  • alinawaz Profile Picture
    209 on at

    Thanks a bunch  Gunjan Bhattachayya 
    The code worked like charm, I was so occupied in making the form control work that I completely forgot about directly assigning value at table level.

    Thanks again Brother, You're a life saver. Cheers

  • Gunjan Bhattachayya Profile Picture
    35,423 on at

    Glad to be of help Ali :)

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 616

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 460 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 331 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans