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

Announcements

News and Announcements icon
Community site session details

Community site session details

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

How to call more than two fields in SysListPanelRelationTableCallback

(0) ShareShare
ReportReport
Posted on by 1,909
Hello,
 
I have simple list and details grid form. Inside the form I created the TabPage its control available customers and drop the values of available customers to right side in not available customers custom table called DAWCustomerSeqMaster. Everything works well and its created customer account and RouteID in DAWCustomerSeqMaster. But In DAWCustomerSeqMaster I have one more field called Day and I need to take the value from my comboBox.valuestr() and fill in to related table DAWCustomerSeqMaster. Below is my code for SysListPanelRelationTableCallback. I need one more column   after fieldnum(DAWCustomerSeqMaster, RouteID) to take value from comboBox.valuestr(). Please advice.
 
 public void init()
    {
       container columns;
       #ResAppl
       columns = [0,0];
       listPanel = SysListPanelRelationTableCallback::newForm(
       element,
       element.controlId(formControlStr(DAWCustSeq, Customers)), //1
         /Assigned Customers/,//2
        /Select Customers To Assign/,  //3 
       #ImageCustomer,//4
       tablenum(DAWCustomerSeqMaster),//5
       fieldnum(DAWCustomerSeqMaster, CustAccount),//6
       fieldnum(DAWCustomerSeqMaster, RouteID),  
       tablenum(DAWCustomerSeqMaster),//8
       fieldnum(DAWCustomerSeqMaster, RouteID),//9
       columns,
       0, //11
       '',//12
       '',//13
       identifierStr(assignedCustomer),//14
       identifierStr(unassignedCustomer));//15
       super();
      
       listPanel.init();
    }
I have the same question (0)
  • Waed Ayyad Profile Picture
    9,212 Super User 2026 Season 1 on at
    Hello Faqru,
     
    I need to ask you some questions in order to help you better:
     
    Does the form is custom form or standard?

    Does the Combo box is bound to the datasource?
    if not why you don’t bound it to the datasource?

    Did you try to add the field as a control on the form? 

    Thanks
    Waed Ayyad
     
  • Faqruddin Profile Picture
    1,909 on at
    Hello Waed,
     
    Its Custom form. The combo box is not bound to the datasource. Because the actual datasource(DAWCustomerSeqMaster) has multiple repeated days as a normal string field. So I added combo box WeekDays enum to filter the related data from datasource. Now my target is I need to insert the selected combo box Week Day value in the custom table called DAWCustomerSeqMaster. Please see below screenshot I'm moving Select Customer To Assign from left to right Assign new customers to make the customer available on specific day for specific Rout in DAWCustomerSeqMaster table. The records CustAccount and RoutID is successfully created in DAWCustomerSeqMaster. But In DAWCustomerSeqMaster I have one more field called Day and I need to fill this field from WeekDays combo box selection once I move the customer from left to right.
     



    Please have look my form full code.

    [Form]
    public class DAWCustSeq extends FormRun
    {
        SysListPanelRelationTableCallback    listPanel;
     
        container  unassignedCustomer()
         {
             container assignedCustomer, data;
              DirPartyTable dirPartyTable;
              CustTable custTable;
              DAWCustomerSeqMaster _seqMaster;
            
            while select  dirPartyTable join custTable where custTable.Party == dirPartyTable.RecId && dirPartyTable.RouteID == DAWRoutes_RouteID.valueStr()
            notexists join _seqMaster
              where  _seqMaster.CustAccount == custTable.AccountNum
                      && _seqMaster.Day == WeekDays.valueStr()
             {
             
                 data = [custTable.AccountNum,
                        custTable.AccountNum,
                    custTable.name()
                        ];
                assignedCustomer +=[data];
             }
             
            return assignedCustomer;
         }
         container assignedCustomer()
         {
             container assignedCustomer, data;
             DirPartyTable dirPartyTable;
             CustTable custTable;
             DAWCustomerSeqMaster _seqMaster;
            
             while select  dirPartyTable join custTable where custTable.Party == dirPartyTable.RecId && dirPartyTable.RouteID == DAWRoutes_RouteID.valueStr()
              exists join _seqMaster
              where  _seqMaster.CustAccount == custTable.AccountNum
                   && _seqMaster.Day == WeekDays.valueStr()
             {
             
                 data = [custTable.AccountNum,
                        custTable.AccountNum,
                         custTable.name()
                        ];
                 assignedCustomer +=[data];
             }
             
             return assignedCustomer;
         }
     
        public void init()
        {
           DAWCustomerSeqMaster _DAWCustomerSeqMaster;
           container columns;
           #ResAppl
           columns = [0,0];
           listPanel = SysListPanelRelationTableCallback::newForm(
           element,
           element.controlId(formControlStr(DAWCustSeq, Customers)), //1
             "Assigned Customers",//2
            "Select Customers To Assign",  //3
           #ImageCustomer,//4
           tablenum(DAWCustomerSeqMaster),//5
           fieldnum(DAWCustomerSeqMaster, CustAccount),//6
           fieldnum(DAWCustomerSeqMaster, RouteID),  
           tablenum(DAWCustomerSeqMaster),//8
           fieldnum(DAWCustomerSeqMaster, RouteID),//9
           columns,
           0, //11
           '',//12
           '',//13
           identifierStr(assignedCustomer),//14
           identifierStr(unassignedCustomer));//15
           super();
           listPanel.init();

          
        }
        public void refillListPane()
        {
            listPanel.parmRelationRangeValue(DAWCustomerSeqMaster.RouteID); //Route-A
            listPanel.parmRelationRangeRecId(DAWCustomerSeqMaster.RecId);
            listPanel.fill();
        }
        [DataSource]
        class DAWCustomerSeqMaster
        {
            /// <summary>
            ///
            /// </summary>
            /// <returns></returns>
            public int active()
            {
                int ret;
        
                ret = super();    
                if(DAWRoutes.RouteID)
                {
                    info(DAWRoutes.RouteID);
                    element.refillListPane();
                }
                return ret;
            }
            /// <summary>
            ///
            /// </summary>
            public void executeQuery()
            {
                QueryBuildDataSource  queryBuildDataSource;
                queryBuildDataSource = this.query().dataSourceTable(tablenum(DAWCustomerSeqMaster));
                queryBuildDataSource.clearRanges();
                queryBuildDataSource.addRange(fieldnum(DAWCustomerSeqMaster, RouteID)).value(queryValue(WeekDays.valueStr()));
                super();
                }
        }
        [DataSource]
        class DAWRoutes
        {
            /// <summary>
            ///
            /// </summary>
            /// <returns></returns>
            public int active()
            {
                int ret;
        
                ret = super();
                if(DAWRoutes.RouteID)
                {
                
                    WeekDays.selection(WeekDays::None);
                   
                }
        
                return ret;
            }
        }


        
        
        
        [Control("ComboBox")]
        class WeekDays
        {
            /// <summary>
            ///
            /// </summary>
            /// <returns></returns>
            public int selectionChange()
            {
                int ret;
        
                ret = super();
                DAWCustomerSeqMaster_DS.executeQuery();
                
                return ret;
            }
        }
        [Control("TabPage")]
        class Customers
        {
            /// <summary>
            ///
            /// </summary>
            public void pageActivated()
            {
                element.refillListPane();
                super();
            }
        }
    }

     
    Thanks
  • Faqruddin Profile Picture
    1,909 on at
    Hello Waed,
     
    Hope you clear with my last reply. Please let me know If you need me to provide more information.
     
    Thanks
  • Waed Ayyad Profile Picture
    9,212 Super User 2026 Season 1 on at
    Hi Faqru,
     
    Did you try to override the button that move the record from the left grid to the right grid and add the code that set the day of week field there?
     
    Also I noticed  you are used YourComboBox.Valuestr()
    use YourComboBox.selection() instead.
     
    Also I see you add range in the excuteQuery(), this will add range and will not set the combo box field try to set the field on the Write() method. Try my suggestions and tell us if it is help you.
     
     
    Thanks
    Waed Ayyad
  • Faqruddin Profile Picture
    1,909 on at
    How can I set combo box field on the Write() method. I know validateWrite(). Can I have snippet of the code for write().
     
    Thank you.
  • Suggested answer
    Waed Ayyad Profile Picture
    9,212 Super User 2026 Season 1 on at
     
    You can right click on your datasource for  DAWCustomerSeqMaster table, override write method and add this code:
     
    
    public void write()
    {
      super();
    
      DAWCustomerSeqMaster.Day =  YourComboBox.selection();
    }
    
     Give it a try and let me know if you still need help.
     
     
    Thanks.
    Waed Ayyad
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future
  • Faqruddin Profile Picture
    1,909 on at
    Hi Waed,
     
    Yes I try this approach last two days ago. But the record is not created in DAWCustomerSeqMaster.Day. I try also DataSourceEventHandler.Written and its same. I need additional business logic to play after records inserted into DAWCustomerSeqMaster using listPanel. Please have a look below code as well.
       [FormDataSourceEventHandler(formDataSourceStr(DAWCustSeq, DAWCustomerSeqMaster), FormDataSourceEventType::Written)]
        public static void DAWCustomerSeqMaster_OnWritten(FormDataSource sender, FormDataSourceEventArgs e)
        {
            FormRun                 form           = sender.formRun();
            FormDataSource         DAWCustomerSeqMaster_ds =       form.dataSource(formDataSourceStr(DAWCustSeq,DAWCustomerSeqMaster)) as FormDataSource;
            DAWCustomerSeqMaster             _dawCustBuffer    = DAWCustomerSeqMaster_ds.cursor();
           
            if(_dawCustBuffer.RecId)
            {
                //do something
            }
        }
     
     
     
     

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 June Top 10 Community Leaders

These are the community rock stars!

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

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 410 Super User 2026 Season 1

#2
Subra Profile Picture

Subra 390

#3
Martin Dráb Profile Picture

Martin Dráb 262 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans