Skip to main content

Notifications

Dynamics 365 Community / Forums / Finance forum / Clearing out financial...
Finance forum
Suggested answer

Clearing out financial dimension form control values

Posted on by 273
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
    CU29041349-0 273 on at
    Clearing out financial dimension form control values
    I tried this following method and it appears to be working with initial tests. I created a temp table with a single defaultdimension field. I related it to DimensionAttributeValueSet. I used this table in my form much like I did with HcmEmployment with the exception that I called create() and insert() on my temp table. Again, it seems to be working. Curious if such an approach may have any unseen issues I'm not aware of. 
  • CU29041349-0 Profile Picture
    CU29041349-0 273 on at
    Clearing out financial dimension form control values
    Hi Bharani,
    The control is linked to HcmEmployment as a Dimension entry control. I would prefer to have an unbound control but I'm not sure how that is accomplished. When you say to follow the SalesTable form example, are you referring to the SalesOrderCreate (or something like that) form? Could you provide specifics? 
  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,548 Moderator on at
    Clearing out financial dimension form control values
    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.
  • Martin Dráb Profile Picture
    Martin Dráb 228,317 Most Valuable Professional on at
    Clearing out financial dimension form control values
    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.
  • CU29041349-0 Profile Picture
    CU29041349-0 273 on at
    Clearing out financial dimension form control values
    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
    Martin Dráb 228,317 Most Valuable Professional on at
    Clearing out financial dimension form control values
    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
    CU29041349-0 273 on at
    Clearing out financial dimension form control values
    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
    Martin Dráb 228,317 Most Valuable Professional on at
    Clearing out financial dimension form control values
    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
    CU29041349-0 273 on at
    Clearing out financial dimension form control values
    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.
  • CU29041349-0 Profile Picture
    CU29041349-0 273 on at
    Clearing out financial dimension form control values
    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. 

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

Dynamics 365 Community Update – Sep 16th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

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

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,435 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,317 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans