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

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

HRM Fixed Compensation dialog form custom field issue

(0) ShareShare
ReportReport
Posted on by 209

Hi Community experts,
 
I am having a problem with the Form named /HcmCompFixedEmplActionDialog/.
Navigation: Worker> Fixed Plan> New
 
 

 

 
What I am trying to do with this form is, I have added a custom field on it and I want to save this field's value in the Table /HRMCompFixedEmpl/ which is the base table and datasource for the main form /HRMCompFixedEmpl/.
The main form only allows to insert a new record via this dialog form /HcmCompFixedEmplActionDialog/ and this dialog form does not have any datasource associated with it. All the fields on the form are getting values/data through the form's code and a class named /HrmCompFixedEmplAction/.
 
 

 


I have tried different CoCs but its not working for me. Didn't find the correct method/class to extend.
I wrote CoC for the OkButton (CloseOkay Method of form) but strange enough I found out the record in table /HRMCompFixedEmpl/ is not created right after the OkButton is clicked. So I can not update the table because there's no buffer at the time of click on OkButton. But my field resides on the Dialog form so I am limited/bound with this dialog form somehow. I have written a CoC for this form's class where I have stored the value of this custom field (real type form control) in a variable and returning it through a method. But I am stuck with not knowing the correct class or method to pass it to at the right time of execution.
 
My only goal is to insert the value of this custom dialog field into the table /HRMCompFixedEmpl/ when OkButton is clicked.
 
Looking forward to usual helpful responses on this.
 
Best Regards.
I have the same question (0)
  • Martin Dráb Profile Picture
    237,681 Most Valuable Professional on at
    HRM Fixed Compensation dialog form custom field issue
    The mistake you made was that you were trying to guess the right extension point, instead of analyzing the current implementation and making a decision based on this analysis.
     
    If you look into closeOk() method, you'll see the call of compFixedEmplAction.setupHRMCompFixedEmpl(). When you highlight the method and press F12, you'll see its implementation. It doesn't do much: this.initValue(hrmCompFixedEmpl), where this is an instance of HrmCompFixedEmplAction class.
     
    initValue() method is where the form buffer gets populated, and therefore where you should deal with your field too. There are assignments like this: _hrmCompFixedEmpl.PlanId = planId. The question is - how a value gets from the dialog form to variables like planId? We can search for planId in the class and we find that there is a parm method (parmPlanId()). Looking at its references shows us that it's called from planId() method on the dialog form, which is edit method. planId_Control in the form is indeed bound to this edit method.
     
    Therefore you need:
    1. Create an extension of HrmCompFixedEmplAction class.
    2. Add a variable and a parm method for your new value.
    3. Extend initValue() method and put the value from your new variable to a table field.
    4. In the dialog form, use the parm method to set the value in HrmCompFixedEmplAction class.
  • Layan Jwei Profile Picture
    8,097 Super User 2025 Season 2 on at
    HRM Fixed Compensation dialog form custom field issue
    Hi Alinawaz,

    I didn't try it myself, but I looked quickly through the code, and I can see that each control that appear in red in your screenshot in "HcmCompFixedEmplActionDialog" has edit method like this:
     
        public edit HRMCompFixedActionId actionId(boolean set, HRMCompFixedActionId _action)
        {
            if (set)
            {
                compFixedEmplAction.parmActionId(_action);
            }
            return compFixedEmplAction.parmActionId();
        } 
    So you can create an extension class for the dialog, to add a similar method for your field.

    and you need to add a parmMethod like the parmActionId but for your new field in HrmCompFixedEmplAction class (by creating an extension)-- similar to this one for example:
    ​​​​​​​
        /// <summary>
        ///    Gets or sets the <c>HRMCompFixedActionId</c> parameter.
        /// </summary>
        /// <param name="_actionId">
        ///    The value to set.
        /// </param>
        /// <returns>
        ///    The value of the <c>HRMCompFixedActionId</c> parameter.
        /// </returns>
        public HRMCompFixedActionId parmActionId(HRMCompFixedActionId _actionId = actionId)
        {
            actionId = _actionId;
            return actionId;
        }


    Then you will need to do an extension for initMethod in HrmCompFixedEmplAction class as well, to initialize your field like it's done for other fields. Because closeOk method in "HcmCompFixedEmplActionDialog" calls this method "setupHRMCompFixedEmpl" and this method calls InitValue


    Thanks,
    Layan Jweihan
  • Suggested answer
    GirishS Profile Picture
    27,827 Moderator on at
    HRM Fixed Compensation dialog form custom field issue
     Hi alinawaz,
     
    I can see that there is an edit method created for each dialog field in the HcmCompFixedEmplActionDialog form methods - Inside edit method they are assigning each dialog field value to the parm method in the "HrmCompFixedEmplAction" class - On the closeOk method of the form they are calling the "setupHRMCompFixedEmpl " method of the "HrmCompFixedEmplAction"  class - Inside this method they are calling the initvalue method of the same class - Inside initValue method they are assinging each value to HrmCompFixedEmpl table from the parm method variable.
     
    Thanks,
    Girish S.
  • alinawaz Profile Picture
    209 on at
    HRM Fixed Compensation dialog form custom field issue
    Hi Guys,
     
    Thanks for your valuable suggestions, I have followed the suggestions but still stuck with the same problem.
    1- Created edit method in Dialog class extension
    2 - Added variable in Action class extension
    3 - Added parm method in Action class extension
    4 - Wrote CoC of InitValue method in Action class extension
     
     
     
    When I am clicking the Ok button from front-end its still not saving the value of my custom field in the table, Rest of the default fields are getting inserted but not my custom field.
     
    Can you guys please specify what mistake I have made here?
    Best Regards
  • GirishS Profile Picture
    27,827 Moderator on at
    HRM Fixed Compensation dialog form custom field issue
    Where did you declare the buffer "compFixedEmplAction"?
    In the form there is a global variable for HrmcompFixedEmplAction class "hrmCompFixedEmplAction" - You need to use this buffer in your custom edit method.
     
    Thanks,
    Girish S.
  • alinawaz Profile Picture
    209 on at
    HRM Fixed Compensation dialog form custom field issue
    Hi @girish
     
    I have added the class buffer in the dialog form extension class. But the problem still persists
     
     
    The extension class for "HrmCompFixedEmplAction" in unchanged though.
     
     
    One more thing I have noticed is when I put the debugger on initValue method in extension class, it doesn't hit the break point. Whereas the actual initValue method get hit in the debugger.
     
    I am kind of baffled by this situation right now, can you point me in the correct direction please?
     
    Best Regards
  • GirishS Profile Picture
    27,827 Moderator on at
    HRM Fixed Compensation dialog form custom field issue
    This is the issue - You are creating new buffer for HrmCompFixedEmplAction class which is wrong.
    You need to use the same buffer which declared in the form.
     
    Thanks,
    Girish S.
  • alinawaz Profile Picture
    209 on at
    HRM Fixed Compensation dialog form custom field issue
    Girish I believe you are looking at a different form code.
     
    The form I am working with is "HcmCompFixedEmplActionDialog" you are looking at "HRMCompFixedEmplActionDialog"
     
     
    The class buffer in "HcmCompFixedEmplActionDialog" form is declared as "compFixedEmplAction" which I was using earlier in my code before declaring a new variable of this class type.
     
     
    My extension class:
     
  • GirishS Profile Picture
    27,827 Moderator on at
    HRM Fixed Compensation dialog form custom field issue
    Oh, sorry that was my mistake. There is another child class for HrmCompFixedEmplAction which is HrmCompFixedEmplActionTransfer - Inside this class there is a method named "insertFixedEmplRecord" - Try to write COC for this method and check. Also please debug how the classes are initialized.
     
    Thanks,
    Girish S.
  • Martin Dráb Profile Picture
    237,681 Most Valuable Professional on at
    HRM Fixed Compensation dialog form custom field issue
    If you set the value to your own object, it won't have any effect on the standard logic. Your object with the value will cease to exist when the form is closed on and the standard instance of HRMCompFixedEmplActionDialog class will still contain the same data as if you never wrote any code.
     
    But sounds like your variable isn't ever used anyway - you'd get a null reference exception if it was, because you never created an instance.
     
    What was your motivation of creating such a variable? I guess you got this (bad) idea because you're trying to deal with some problem.
     
    By the way, can't you show your complete code (as text, using Insert Code Snippet)?

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Martin Dráb Profile Picture

Martin Dráb 683 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 563 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 398 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans