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, ...
Suggested Answer

Clearing out financial dimension form control values

(3) ShareShare
ReportReport
Posted on by 628
Hello:
I have a custom dialog form with a control attached to HcmEmployment.DefaultDimension. The form works as expected to allow selection of the individual dimension. However, when the form is brought up in subsequent runs, the previous financial dimension values are populated. How can I clear those values to allow the user to start from a clean form? 
  • CU29041349-0 Profile Picture
    628 on at
    Hoping for some feedback on this. Thanks
  • Suggested answer
    Martin Dráb Profile Picture
    240,785 Most Valuable Professional on at
    You seem to be saying that your form (unlike usual dialogs) uses a data source and you have a control bound to a table field. Therefore what you see in the form is a record in HcmEmployment table. You told us nothing about the purpose of your form, but the fact that you expect empty values suggests that you probably want to start with a new, empty record, instead of an existing record. If so, you can create a new record (by create() method of the data source) when opening the form.
  • CU29041349-0 Profile Picture
    628 on at
    Hi Martin,
    Pardon the lack of details. For reasons I won't go into, I'm creating HcmWorker based on input from this form through code. For the HcmEmployment record, I need to gather the financial dimension values. I found it easiest to include the HcmEmployment datasource so I can just pull in the defaultdimension onto the form. Would appreciate it if there's a better option that wouldn't require the datasource. Thank you. 
  • CU29041349-0 Profile Picture
    628 on at
    I proceeded with Martin's suggestion to use the create() method on HcmEmployment for a new record without any defaultdimension value. It clears the values on the form. However, because it is creating a new HcmEmployment record, I get errors requiring Worker and Company. My custom form will be responsible for creating the worker (and accompanying employment, dirpersonname, position) through code so there is no worker to assign to HcmEmployment at this point. Not sure it's appropriate to pivot the question on this post, but is it possible to include the financial dimensions into the form without linking it to a datasource? I probably will add a new post just in case changing the nature of the question is bad form.
    Thanks.
  • Martin Dráb Profile Picture
    240,785 Most Valuable Professional on at
    You get errors when you try to save the record, but you don't want to save it anyway, therefore even the attempt is a bug. If you want to use a data source, you should avoid saving (by overriding write() and validateWrite() method of the DS and not calling super() there).
     
    But yes, you can use unbound controls. Dialog typically don't have data sources.
  • CU29041349-0 Profile Picture
    628 on at
    Thank you, Martin. Would you be open to providing some details on how to add an unbound financial dimension control? 
  • Martin Dráb Profile Picture
    240,785 Most Valuable Professional on at
    I don't have time to cover all the options; we can discuss it next week if needed. But one example you can look at is AssetTransferMassUIBuilder. There they don't need a modeled form at all, as usual with dialogs. The default dialog is generated from the contract class and modified by the UI builder class.
  • CU29041349-0 Profile Picture
    628 on at
    My dialog utilizes a form pattern. Not sure if the AssetTransferMassUIBuilder can be utilized but I will review it. 
     
    I would appreciate any further advice you're able to share. Thank you. 
  • Martin Dráb Profile Picture
    240,785 Most Valuable Professional on at
    Then you need to add a DimensionEntry control to your form.
     
    Here someone suggested that you need a specialization of the control, but I don't think it's necessary. I would have to try it and I don't have time at the moment.
     
    It'll help if actually try to add the unbound control and explain your particular problem if you run into any, instead of waiting for others.
  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    3,634 Moderator on at
    When you say form is opening with previous values, is the default dimension already filled? If yes, how is it getting filled? 
     
    As Martin suggested, you can follow the SalesTable form approach and create a Dimension Entry control.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

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

#1
Martin Dráb Profile Picture

Martin Dráb 430 Most Valuable Professional

#2
CU10121822-0 Profile Picture

CU10121822-0 368

#3
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 364 Super User 2026 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans