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

How to change a field in a form with Segmented Entry ?

(0) ShareShare
ReportReport
Posted on by 596
Hi guys,
 
May I know how to modified field value in a form with Segmented Entry ?
My intention is with form Deferral from Sales Order (this is a Subscription Billing feature) like this :
  1. When I open Sales Order, in Order line action pane there is one button labeled /Deferrals/ and when it is open will be looks like this ->
            
 
         2.  When the /Deferred/ check box turn on, it will populated based on the default given.
 
              
           3. Issue is when it is turn off, not all the value cleared ->
 
               
 
When I take a look at the form designer, there is some field with /Segmented Entry/ ->
 
I figured this is the field in relate to the problem, however I don't know how to clear this out.
Anyone can guide me on this ?
 
Thanks in advance,
 
 
 
 
 
I have the same question (0)
  • Suggested answer
    GirishS Profile Picture
    27,825 Moderator on at
    How to change a field in a form with Segmented Entry ?
    Hi Voltes,
     
    Refer to the below blog and see if its helps.
     
    Thanks,
    Girish S.
  • Voltes Profile Picture
    596 on at
    How to change a field in a form with Segmented Entry ?
    Hi Girish,
     
    Sorry, I'm pretty much a beginner about this development.
    Looking through the blog I figured is that if we have our custom form ? because he can modified the form run.
    With my issue, can I say we need to create Extension class for this form  ?
     
    but what function I should create in the extension class ?
    can you help to guide me what I need to do step by step ?
     
    Thanks in advance.
  • GirishS Profile Picture
    27,825 Moderator on at
    How to change a field in a form with Segmented Entry ?
    Yes you need to create an extension class for the form. Either you can go for COC or event handlers.
     
    Thanks,
    Girish S.
  • Voltes Profile Picture
    596 on at
    How to change a field in a form with Segmented Entry ?
    Hi Girish,
     
    For CoC, may I know what function I should create the extension ?
    I'm sorry I have pretty basic only for development, as well as CoC. But if not mistaken, there is no "Run()" method, am I right to say that ?
     
    Can give some example that translate that blog into this CoC thing ?
     
    Thanks in advance.
     
     
  • Suggested answer
    Mohit Rampal Profile Picture
    12,565 Moderator on at
    How to change a field in a form with Segmented Entry ?
    Hi Voltes, There is 'run' method in form as specified below. You can create CoC on run method in form extension class
     
     
    [ExtensionOf(formStr(SubBillDeferralTransactionDeferral))]
    public final class SubBillDeferralTransactionDeferral_F_Extension
    {
        public void run()
        {
            next run();
            //write your code
        }
    }
     
  • GirishS Profile Picture
    27,825 Moderator on at
    How to change a field in a form with Segmented Entry ?
    Yes, there is no event handler for run method.
    You need to write COC for run method.
    Other code in the run method remains same - Instead of super you need to have the next call as mentioned in the blog
     
    Thanks,
    Girish S.
     
  • Voltes Profile Picture
    596 on at
    How to change a field in a form with Segmented Entry ?
    Hi both,
     
    Thanks.
    I want to understand what is needed to make a correct COC.
    So, the intention is whenever the form displayed, the standard form will do this :
    1. Turn ON the Deferred check box, all the accounts setup in Accounts section will be filled in.
    2, Turn OFF the Deferred check box, standard "forget" to clear the Revenue Recognition account number.
     
    Which number two that I would like to "fix" it.
     
    So, by referring to the blog, I'm creating this COC:
     
    [ExtensionOf(formStr(SubBillDeferralTransactionDeferral))]
    final class MY_SubBillDeferralTransactionDeferralForm_Extension
    {
        /// <summary>
        ///
        /// </summary>
        public void run()
        {
            Object                      formControlObject;
            FormControl                 formControl;
            FormStringControl           formStringControl;
            FormReferenceGroupControl   referenceGroupControl;
            int                         i;
            
            next run();
            
            referenceGroupControl = this.design().controlName(formControlStr(SubBillDeferralTransactionDeferral, SubBillDeferralDeferred));
            for (i = 1; i <= referenceGroupControl.controlCount(); i++)
            {
                formControl = referenceGroupControl.controlNum(i);
                formStringControl = formControl as FormStringControl;
                if (formStringControl != null)
                {
                    formStringControl.registerOverrideMethod(methodStr(FormStringControl, modified), identifierStr(resetReferenceGroupModified), element);
                }
            }
        }
        public boolean resetReferenceGroupModified(FormStringControl _control)
        {
            if (_control.text() == '')
            {
                if (!SubBillDeferralTransactionLineDeferral.SubBillDeferralDeferred)
                {
                    SubBillDeferralTransactionLineDeferral.SubBillDeferralRecognitionAccount = 0;
                }
            }
            return true;
        }
        
    }
     
    This is my understanding:
    1. Variable referenceGroupControl is the variable that holds the Deferred check box account
    2. The rest inside this extension run() method, will be the same. And what I think for this statement is to "catch" the modified action.
    3. The addition function resetReferenceGroupModified, is served as the modifier of the value, so I'm added condition when "Deferred control" is not check (by using exclamation), then the other field for SubBillDeferralRecognitionAccount  would need to be zero.
     
    May I know is this correct ?
    But then again I face error "element is not declared" like below:
     
    May I know what is the error means ?
     
    Thanks in advance.
     
     
     
     
     
     
     
  • GirishS Profile Picture
    27,825 Moderator on at
    How to change a field in a form with Segmented Entry ?
    I am not sure with the error. You never used element in the code but its throwing like element is not delcared.
    Try like below code. Use element keyword to get the current cursor.
    public boolean resetReferenceGroupModified(FormStringControl _control)
        {
            SubBillDeferralTransactionLineDeferral deferral = element.SubBillDeferralTransactionLineDeferral;
            if (_control.text() == '')
            {
                if (!deferral .SubBillDeferralDeferred)
                {
                    deferral .SubBillDeferralRecognitionAccount = 0;
                }
            }
            return true;
        }
     
    Thanks,
    Girish S.
  • Voltes Profile Picture
    596 on at
    How to change a field in a form with Segmented Entry ?
    Yeah, not sure what the error element not declared is ?
     
    Also got another problem whereby the "modified" is NOT HOOKABLE. As per my understanding, we cannot add anything (extension or event handler), is it ?
     
    Anyway, this is the screen capture with the Build error ->
     
     
    Thanks,
  • GirishS Profile Picture
    27,825 Moderator on at
    How to change a field in a form with Segmented Entry ?
    Error is because the control "SubBillDeferralDeferred" has DataSource method modified which has set to hookable false. So, you can't right modified method for this control.
    Also why you are mentioning the control SubBillDeferralDeferred?
    You need to mention the control name "SubBillDeferralRecognitionAccount".
     
    Thanks,
    Girish S.

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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

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

#1
Martin Dráb Profile Picture

Martin Dráb 596 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
CU05031448-0 Profile Picture

CU05031448-0 556

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans