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

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

How I Add my basic field in my form.

(0) ShareShare
ReportReport
Posted on by 276
Dear All,
 
I have a question that I customize my from to add a basic field  and after press /OK/ it should be flow to save data in my table.
//
 
1. I Extend a form /EcoResProductCreate/ but for this form it don't have a data Source
//
 
 
After that I would like to edit a OK button to do everything to be the same but add data on customize field/HSCODE/ to table /EcoResProduct/ 
Same table of field /Product Number/
//
 
But I don't know how to do? I try to create a class extension to save data in the same table but I don't know how to do?
 
//
 
Can someone guide me how to do?
 
Thanakorn
I have the same question (0)
  • Suggested answer
    Waed Ayyad Profile Picture
    9,039 Super User 2025 Season 2 on at
     
    You can add logic to insert the data on the new Field but first of all did you added the field to table? Also, I see from the code that you write you created a display method; it is not correct you should debug the code of the click method and see how the product number is created and then you can think how to add your logic to fill your field.
     
    You can use on click event handler of your method and add your code there. the following blog show to add event handler for your button.
     
    Try it and share your code for more details.
     
    Thanks,
     Waed Ayyad
    If this helped, please mark it as "Verified" for others facing the same issue
     
  • Chomchanok Profile Picture
    276 on at
     
    thank you for your guideline.
    1. first of all did you added the field to table? (Yes)
     
    I see from the code that you write you created a display method
    (This is a mock up class that I don't know where I can write the code, On the concept I know that I need to override the even handler for "OK Button" but I try to click left,right but I didn't see a menu to do override method).
     
    and this is a code that I prepare for but I don't know where I put my code 
    //////////////////////////////////////////////////////////////////////////////////////////////////////////
    [ExtensionOf(formStr(EcoResProductCreate))]
    final class EcoResProductCreate_HSTH_Extension
    {
        public void clicked()
        {
            // Override the clicked method for the OK button to save data
            super();
            // Access your custom field value
            str hSCodeValue = this.design().HSCODE.value();
            // Create a new record buffer for EcoResProduct table
            EcoResProduct ecoResProduct;
            // Insert your custom logic to populate the record buffer with data
            //ecoResProduct.ProductNumber = // Populate with appropriate value;
            ecoResProduct.HSCODE = hSCodeValue; // Populate with your custom field value
            // Save the record
            ttsBegin;
            ecoResProduct.insert();
            ttsCommit;
        }
    }
    //////////////////////////////////////////////////////////////////////////////////////////////////////////
  • Suggested answer
    Waed Ayyad Profile Picture
    9,039 Super User 2025 Season 2 on at
     
    From here right click on the Event OnClicked then choose Copy Event handler Method:
     
     
  • Suggested answer
    Waed Ayyad Profile Picture
    9,039 Super User 2025 Season 2 on at
    Hi,
     
    You can start from here:
    internal final class EcoResProductCreateFormHSTH_EventHandler
    {    
        
     [FormControlEventHandler(formControlStr(EcoResProductCreate, OKButton), FormControlEventType::Clicked)]   
     public static void OKButton_OnClicked(FormControl sender, FormControlEventArgs e)   
     { 
          FormRun formRun = sender.formRun();         
          //Add your logic 
     }  
    }
    
     
  • Waed Ayyad Profile Picture
    9,039 Super User 2025 Season 2 on at
    Hi,
     
    Did you try the hints I give it to you? Do you want additional help?
     
     
     
    Thanks,
    Waed Ayyad
     
  • Chomchanok Profile Picture
    276 on at
     
    Thank you for your guideline. After I got your information then I try to do step by step
    1. I Extend My class.
    2. I right click and Copy Event Handler Method
    3.I press in my (Extend) Class then I try to simulate a logic that should be here but I don't know how to refer my field in that form?


     



  • Verified answer
    Chomchanok Profile Picture
    276 on at
     
    Let's I update my issue: For now I think my issue is resolved.
     
    Thank you for your guideline.

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 664 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 303 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans