SlideShare uma empresa Scribd logo
1 de 34
Microsoft Dynamics® AX 2012
Forms/tables methods call sequences
Objectifs
• Describe the methods call sequencing
• Describe the forms and tables methods and
when they should be override
• Describe how to access form objects
• Describe how to do some common tasks on
forms
Methods call sequencing
Cases
• Case 1: Form opening
• Case 2: Record creation
• Case 3: Field modification
• Case 4: Record saving
• Case 5: Record deletion
• Case 6: Form closing
• Case 7: RunBase
Form opening
Form Opening
Form.init
• Used to retrieve and validate the calling parameters
• Initialize Controls : Visibility, Enable, Editable…
• Do not put code that affects DS in this method use DS.init instead
DS.init
• Set Data Source properties : AllowEdit, AllowCreate, AllowDelete…
• Create ranges, sorting and filters
• Cache methods to improve performance
• Not apply ranges values only if the ranges/links… are permanent
Form Opening
DS.linkActive
• This methods is called every time we activate a new record on the
calling form
• Applying links, ranges and updating design depending on the caller
record!
DS.executeQuery
• Applying ranges and filters values
• Avoid changing the query structure (create ranges, links…) at this
level as this method is frequently called
DS.active
• Updating design depending on the selected record
• Updating other Data Sources queries
Record creation
Record creation
DS.Create
• Add supplementary rules to validate the creation
• Modify creation process : example open a specific form for creation
DS.initValue
• Only to initialize fields with values that can not exists outside of the
form, example :
• Filter on the top of the form
• Values coming from a calling form/class
Table.initValue
• Assign a default value to fields
• Always call this method when creating records by X++ code even if
the method is empty : It may be overridden in a future version!
Field modification
Field modification
Control.validate - Control.Modified
• never!
DSField.validate
• Validate the value typed / chosen by the user against business rules
and data consistency
DSField.modified
• Modify value on other fields
• Implement field modification rules
When : code we want to implement is specific to the form, or depends on some data that
are only available on the form
Table.validateField, table.modifiedField
Same as DS methods. These methods are called what ever the form.
Field modification
In modifiedField methods, you should always make sure that the code you
have implemented will be cancelable if the user choose not save the changes
he made. Else you have to force the saving of the record!
Incorrect :
Correct :
Field modification
Modifying a field value by X++
You should be sure the value you are assigning to the field respect
business rules, as the system will not trigger a validateField method call
automatically!
Lookup consideration
When you override the default lookup of a field to filter values that can
be chosen by the user. You should always override validateField or
validate to consider the case when the user type directly a value in the
field without using the lookup.
Record saving
Record saving
DS.validateWrite
• Validate business rules and data consistency (mandatory fields filled…) that
are form specific
Table.validateWrite
• Same as the DS equivalent but will be applied on all forms
DS.Write
• Updating other DS in the same form
• Override the normal saving process with some specific rules
Table.insert / Tables.update
• Implement specific rules : CUD other record, recalculate a value…
Record saving
• When inserting/updating records by X++ code you should always call
Table.validateWrite in order o validate business rules/ mandatory fields…
Even if the method is empty!
• Avoid direct call to doInsert/doUpdate, as all business rules that are written
in insert/update are not executed. Only use direct call if :
1. Performance issues
2. You are sure that business rules implemented in insert/update are not applicable in your
use case.
Creation/update by X++ Code should be done using AxBC classes because they implement a Framework to
correctly validate fields values and business rules. This will be discussed in an other session.
Record deletion
Record deletion
Delete Actions
You should always remember to implement Delete Actions when your table is
linked to other tables! Forgetting this can lead to data inconsistency.
In X++ code you should always call Table.validateDelete before calling delete
Form closing
Form closing
How to catch closing method of a form
• ClosedOk : form has been closed using OK command button
• ClosedCancel : form has been closed using a cancel command button or
Esc
• Closed : form has been closed “Normally”
Runbase
RunBase
Main
• Keep the code as minimum as possible
• Used to retrieve and validate calling parameters, instantiate a class objects
and initialize class object parameters
Construct
• Always create a construct method to encapsulate the new Method
InitParmDefault
• Use this method to default class variables/query with default values for the
first class run by the user.
HOW TO ?
How to acces form objects
• FormRun : element, this
• DataSource : DataSourceName_ds, this
• Active Record : DataSourceName
• DataSource Query : DataSourceName_q
• DataSource Query Run : DataSourceName_qr
• Field value : DataSourceName.Field
• Control
element.control(element.controlId(formControlStr(FormName, ControlName)))
Or
AutoDeclaration
General rules
• Do not place code in a form unless you cannot place it in
a class or in a table method.
• Code written on forms cannot be reused and is difficult to
customize.
• Forms are entirely client-based. There should be no code in
them that manipulates the database.
• Always Use Field Groups in Tables
• To modify text that appears in the user interface you
should modify property values on the extended data
types or base enums in the application.
General rules
• If a control is linked to a field data source, You
should never AutoDeclare this control. All
behavior changes (visibility, mandatory, enable,
…) can be done throw the data Source. Next
slides shows you how you can do common
tasks!
How To ?
How to enable/disable a control
Incorrect :
ControlName.enabled(true/false);
Correct :
DataSourceName_ds.object(fieldnum(Table, Field)).enabled(true/false);
How to set visibility of a control
Incorrect :
ControlName.visible(true/false);
Correct :
DataSourceName_ds.object(fieldnum(Table, Field)).visible(true/false);
How To ?
How to make a control editable
Incorrect :
ControlName.allowEdit(true/false);
Correct :
DataSourceName_ds.object(fieldnum(Table, Field)).allowEdit(true/false);
How to make a control mandatory
Incorrect :
ControlName.mandatory(true/false);
Correct :
DataSourceName_ds.object(fieldnum(Table, Field)).mandatory(true/false);
How to?
Assign a value to a control
Incorrect
Contol.text(value), control.realvalue(value), control. Checked(Value)…
Correct
DataSourceName.Field = Value;
How to?
Allow/prevent record creation/modification/deletion
Creation
• Propriety : AllowCreate
• X++ : DataSourceName_ds.allowCreate()
Modification
• Propriety : AllowEdit
• X++ : DataSourceName_ds.allowEdit()
Deletion
• Propriety : AllowDelete
• X++ : DataSourceName_ds.allowDelete()
NOT CORRECT
Making Buttons that allow creation/modification/deletion disabled doesn’t prevent doing
theses action. As there are shortcuts (Ctrl+N, Alt+F9…) that trigger the same events!
How to?
Cache methods (1)
Method caching mechanism helps improve performances.
DataSource_ds.cacheAddMethod(tableMethodStr(TableName, MethodName));
(1) Caching mechanism will be discussed in details in an other session.
How to?
Create/Apply range on a form DS
1. Declare a variable QueryBuildRange on classDeclaration
2. Create and assign the range in DS.init() after super()
3. Apply the range value in DS.executeQuery or DS.linkActive
Add a filter control to a form (not listPage)
1. Declare a Range as previous
2. Declare a variable in class Declaration with desired type
3. Create an edit method on form methods on the declared variable
4. Call the DS.executeQuery() and use the variable as a value for the range
5. Create a control on the form using the edit method
6. Optional : Save the filter value by user by overriding methods
In some cases you may have to use QueryFilter and not QueryBuildRange. See :
- http://msdn.microsoft.com/en-us/library/hh745335.aspx
- http://msdn.microsoft.com/en-us/library/gg881181.aspx
How to?
Add a filter control to a listPage
1. Turn the “Filter” group visible = Yes
2. Add a control to the group and specify properties : Label, helpText, CK…
3. Specify properties :
1. FilterDataSource : data source you want to filter
2. FilterField : field to filter based on it
3. FilterExpression : %1, !=%1, ..%1, %1..
A standard framework behind listPage will apply filter once a value is specified!
Contact me
Mohamed Amine HAMDAOUI
mahamdaoui@toolconsulting.com
www.toolconsulting.com
Phone
+212 (0) 6 69 42 79 94
Please don’t hesitate to contact me if you find any error on the document or if you have
any questions.
Thanks for your time, and see you in the next Lab!

Mais conteúdo relacionado

Mais procurados

Microsoft dynamics ax 2012 development introduction part 2/3
Microsoft dynamics ax 2012 development introduction part 2/3Microsoft dynamics ax 2012 development introduction part 2/3
Microsoft dynamics ax 2012 development introduction part 2/3Ali Raza Zaidi
 
An Introduction to the Dynamics AX Application Integration Framework
An Introduction to the Dynamics AX Application Integration FrameworkAn Introduction to the Dynamics AX Application Integration Framework
An Introduction to the Dynamics AX Application Integration FrameworkFolio3-Dynamics-Services
 
Developing ssrs-reports-for-dynamics-ax
Developing ssrs-reports-for-dynamics-axDeveloping ssrs-reports-for-dynamics-ax
Developing ssrs-reports-for-dynamics-axNicc Ngo
 
Microsoft Dynamics AX 2012 - X++ Compiled to CIL
Microsoft Dynamics AX 2012 - X++ Compiled to CILMicrosoft Dynamics AX 2012 - X++ Compiled to CIL
Microsoft Dynamics AX 2012 - X++ Compiled to CILFabio Filardi
 
Redesigning Hyperion Planning - Is going from Block Storage (BSO) to Aggregat...
Redesigning Hyperion Planning - Is going from Block Storage (BSO) to Aggregat...Redesigning Hyperion Planning - Is going from Block Storage (BSO) to Aggregat...
Redesigning Hyperion Planning - Is going from Block Storage (BSO) to Aggregat...finitsolutions
 
Dynamics ax 2012 development overview
Dynamics ax 2012 development overviewDynamics ax 2012 development overview
Dynamics ax 2012 development overviewAli Raza Zaidi
 
Microsoft Dynamics AX 2012 - Services Overview
Microsoft Dynamics AX 2012 - Services OverviewMicrosoft Dynamics AX 2012 - Services Overview
Microsoft Dynamics AX 2012 - Services OverviewFabio Filardi
 
Developing ssrs-reports-for-dynamics-ax-120402001948-phpapp01
Developing ssrs-reports-for-dynamics-ax-120402001948-phpapp01Developing ssrs-reports-for-dynamics-ax-120402001948-phpapp01
Developing ssrs-reports-for-dynamics-ax-120402001948-phpapp01Ahmed Farag
 
Dynamics Ax Retail Installation Vijay Sharma
Dynamics Ax Retail Installation Vijay SharmaDynamics Ax Retail Installation Vijay Sharma
Dynamics Ax Retail Installation Vijay SharmaVijay Sharma
 
AX 2012 R3 Installation Guide
AX 2012 R3 Installation GuideAX 2012 R3 Installation Guide
AX 2012 R3 Installation GuideBiswanath Dey
 
KScope14 Jython Scripting
KScope14 Jython ScriptingKScope14 Jython Scripting
KScope14 Jython ScriptingAlithya
 
Finit solutions - Automating Data Loads with FDMEE
Finit solutions - Automating Data Loads with FDMEEFinit solutions - Automating Data Loads with FDMEE
Finit solutions - Automating Data Loads with FDMEEfinitsolutions
 
Budgeting using hyperion planning vs essbase
Budgeting using hyperion planning vs essbaseBudgeting using hyperion planning vs essbase
Budgeting using hyperion planning vs essbaseSyntelli Solutions
 
Dimensionality & Dimensions of Hyperion Planning
Dimensionality & Dimensions of Hyperion PlanningDimensionality & Dimensions of Hyperion Planning
Dimensionality & Dimensions of Hyperion Planningepmvirtual.com
 
Hyperion planning integration with odi
Hyperion planning integration with odiHyperion planning integration with odi
Hyperion planning integration with odiAmit Sharma
 
Migration Approaches for FDMEE
Migration Approaches for FDMEEMigration Approaches for FDMEE
Migration Approaches for FDMEEAlithya
 

Mais procurados (20)

Microsoft dynamics ax 2012 development introduction part 2/3
Microsoft dynamics ax 2012 development introduction part 2/3Microsoft dynamics ax 2012 development introduction part 2/3
Microsoft dynamics ax 2012 development introduction part 2/3
 
An Introduction to the Dynamics AX Application Integration Framework
An Introduction to the Dynamics AX Application Integration FrameworkAn Introduction to the Dynamics AX Application Integration Framework
An Introduction to the Dynamics AX Application Integration Framework
 
Developing ssrs-reports-for-dynamics-ax
Developing ssrs-reports-for-dynamics-axDeveloping ssrs-reports-for-dynamics-ax
Developing ssrs-reports-for-dynamics-ax
 
Microsoft Dynamics AX 2012 - X++ Compiled to CIL
Microsoft Dynamics AX 2012 - X++ Compiled to CILMicrosoft Dynamics AX 2012 - X++ Compiled to CIL
Microsoft Dynamics AX 2012 - X++ Compiled to CIL
 
Redesigning Hyperion Planning - Is going from Block Storage (BSO) to Aggregat...
Redesigning Hyperion Planning - Is going from Block Storage (BSO) to Aggregat...Redesigning Hyperion Planning - Is going from Block Storage (BSO) to Aggregat...
Redesigning Hyperion Planning - Is going from Block Storage (BSO) to Aggregat...
 
Dynamics ax 2012 development overview
Dynamics ax 2012 development overviewDynamics ax 2012 development overview
Dynamics ax 2012 development overview
 
Microsoft Dynamics AX 2012 - Services Overview
Microsoft Dynamics AX 2012 - Services OverviewMicrosoft Dynamics AX 2012 - Services Overview
Microsoft Dynamics AX 2012 - Services Overview
 
Developing ssrs-reports-for-dynamics-ax-120402001948-phpapp01
Developing ssrs-reports-for-dynamics-ax-120402001948-phpapp01Developing ssrs-reports-for-dynamics-ax-120402001948-phpapp01
Developing ssrs-reports-for-dynamics-ax-120402001948-phpapp01
 
Dynamics Ax Retail Installation Vijay Sharma
Dynamics Ax Retail Installation Vijay SharmaDynamics Ax Retail Installation Vijay Sharma
Dynamics Ax Retail Installation Vijay Sharma
 
AX 2012 R3 Installation Guide
AX 2012 R3 Installation GuideAX 2012 R3 Installation Guide
AX 2012 R3 Installation Guide
 
KScope14 Jython Scripting
KScope14 Jython ScriptingKScope14 Jython Scripting
KScope14 Jython Scripting
 
Finit solutions - Automating Data Loads with FDMEE
Finit solutions - Automating Data Loads with FDMEEFinit solutions - Automating Data Loads with FDMEE
Finit solutions - Automating Data Loads with FDMEE
 
Budgeting using hyperion planning vs essbase
Budgeting using hyperion planning vs essbaseBudgeting using hyperion planning vs essbase
Budgeting using hyperion planning vs essbase
 
Oracle Apps - Forms
Oracle Apps - FormsOracle Apps - Forms
Oracle Apps - Forms
 
Dimensionality & Dimensions of Hyperion Planning
Dimensionality & Dimensions of Hyperion PlanningDimensionality & Dimensions of Hyperion Planning
Dimensionality & Dimensions of Hyperion Planning
 
Index in SAP ABAP
Index in SAP ABAPIndex in SAP ABAP
Index in SAP ABAP
 
Hyperion planning integration with odi
Hyperion planning integration with odiHyperion planning integration with odi
Hyperion planning integration with odi
 
Mdx complex-queries-130019
Mdx complex-queries-130019Mdx complex-queries-130019
Mdx complex-queries-130019
 
Optimization in essbase
Optimization in essbaseOptimization in essbase
Optimization in essbase
 
Migration Approaches for FDMEE
Migration Approaches for FDMEEMigration Approaches for FDMEE
Migration Approaches for FDMEE
 

Destaque

Microsoft Dynamics AX 2012 - Development Introduction Training - Part 3/3
Microsoft Dynamics AX 2012 - Development Introduction Training - Part 3/3Microsoft Dynamics AX 2012 - Development Introduction Training - Part 3/3
Microsoft Dynamics AX 2012 - Development Introduction Training - Part 3/3Fabio Filardi
 
Axapta interview questions
Axapta interview questionsAxapta interview questions
Axapta interview questionsKD420
 
AX2012 AIF(Application Integration Framework) 소개
AX2012 AIF(Application Integration Framework) 소개AX2012 AIF(Application Integration Framework) 소개
AX2012 AIF(Application Integration Framework) 소개Alvin You
 
Dynamic AX : Application Integration Framework
Dynamic AX : Application Integration FrameworkDynamic AX : Application Integration Framework
Dynamic AX : Application Integration FrameworkSaboor Ahmed
 
Execution plan for sql
Execution plan for sqlExecution plan for sql
Execution plan for sqlSatra Eadtrong
 
MB6-890 Transcript.PDF
MB6-890 Transcript.PDFMB6-890 Transcript.PDF
MB6-890 Transcript.PDFRandy King
 
Sql query performance analysis
Sql query performance analysisSql query performance analysis
Sql query performance analysisRiteshkiit
 
Version control in the Dynamics AX
Version control in the Dynamics AXVersion control in the Dynamics AX
Version control in the Dynamics AXAlvin You
 
AX2012 Technical Track - Infrastructure, Davy Vliegen
AX2012 Technical Track - Infrastructure, Davy VliegenAX2012 Technical Track - Infrastructure, Davy Vliegen
AX2012 Technical Track - Infrastructure, Davy Vliegendynamicscom
 

Destaque (11)

Microsoft Dynamics AX 2012 - Development Introduction Training - Part 3/3
Microsoft Dynamics AX 2012 - Development Introduction Training - Part 3/3Microsoft Dynamics AX 2012 - Development Introduction Training - Part 3/3
Microsoft Dynamics AX 2012 - Development Introduction Training - Part 3/3
 
Axapta interview questions
Axapta interview questionsAxapta interview questions
Axapta interview questions
 
AX2012 AIF(Application Integration Framework) 소개
AX2012 AIF(Application Integration Framework) 소개AX2012 AIF(Application Integration Framework) 소개
AX2012 AIF(Application Integration Framework) 소개
 
Dynamic AX : Application Integration Framework
Dynamic AX : Application Integration FrameworkDynamic AX : Application Integration Framework
Dynamic AX : Application Integration Framework
 
Faisal engineer (1)
Faisal engineer (1)Faisal engineer (1)
Faisal engineer (1)
 
Execution plan for sql
Execution plan for sqlExecution plan for sql
Execution plan for sql
 
MB6-890 Transcript.PDF
MB6-890 Transcript.PDFMB6-890 Transcript.PDF
MB6-890 Transcript.PDF
 
Sql query performance analysis
Sql query performance analysisSql query performance analysis
Sql query performance analysis
 
Azure overview
Azure overviewAzure overview
Azure overview
 
Version control in the Dynamics AX
Version control in the Dynamics AXVersion control in the Dynamics AX
Version control in the Dynamics AX
 
AX2012 Technical Track - Infrastructure, Davy Vliegen
AX2012 Technical Track - Infrastructure, Davy VliegenAX2012 Technical Track - Infrastructure, Davy Vliegen
AX2012 Technical Track - Infrastructure, Davy Vliegen
 

Semelhante a Microsoft dynamics ax2012 : forms and tables methods call sequences, How To?

20231013_274_ClubServicenow_Catalog.pdf
20231013_274_ClubServicenow_Catalog.pdf20231013_274_ClubServicenow_Catalog.pdf
20231013_274_ClubServicenow_Catalog.pdfTiago Macul
 
Creating a Great XPages User Interface
Creating a Great XPages User InterfaceCreating a Great XPages User Interface
Creating a Great XPages User InterfaceTeamstudio
 
Creating a Great XPages User Interface, TLCC Teamstudio Webinar - Feb, 2014
Creating a Great XPages User Interface, TLCC Teamstudio Webinar - Feb, 2014Creating a Great XPages User Interface, TLCC Teamstudio Webinar - Feb, 2014
Creating a Great XPages User Interface, TLCC Teamstudio Webinar - Feb, 2014Howard Greenberg
 
KWizCom forms - introduction
KWizCom forms - introductionKWizCom forms - introduction
KWizCom forms - introductionNimrod Geva
 
SFDC Other Platform Features
SFDC Other Platform FeaturesSFDC Other Platform Features
SFDC Other Platform FeaturesSujit Kumar
 
Marty, You're Just Not Thinking Fourth Dimensionally
Marty, You're Just Not Thinking Fourth DimensionallyMarty, You're Just Not Thinking Fourth Dimensionally
Marty, You're Just Not Thinking Fourth DimensionallyTeamstudio
 
Jaspersoft and Clarity PPM - Advanced Reporting with Data Warehouse
Jaspersoft and Clarity PPM - Advanced Reporting with Data WarehouseJaspersoft and Clarity PPM - Advanced Reporting with Data Warehouse
Jaspersoft and Clarity PPM - Advanced Reporting with Data WarehouseThiago Bottoni
 
Implementing Tables and Views.pptx
Implementing Tables and Views.pptxImplementing Tables and Views.pptx
Implementing Tables and Views.pptxLuisManuelUrbinaAmad
 
Obiee metadata development
Obiee metadata developmentObiee metadata development
Obiee metadata developmentdils4u
 
Oracle Forms: Introduction to multiple Forms
Oracle Forms: Introduction to multiple FormsOracle Forms: Introduction to multiple Forms
Oracle Forms: Introduction to multiple FormsSekhar Byna
 
The Joy of Subforms with Randy Carey
The Joy of Subforms with Randy CareyThe Joy of Subforms with Randy Carey
The Joy of Subforms with Randy Careyjdaychi
 
DeVry UniversityStudent Lab ActivityBIS245 Database Essentials.docx
DeVry UniversityStudent Lab ActivityBIS245 Database Essentials.docxDeVry UniversityStudent Lab ActivityBIS245 Database Essentials.docx
DeVry UniversityStudent Lab ActivityBIS245 Database Essentials.docxduketjoy27252
 
SA05 - Customizing the User Interface
SA05 - Customizing the User Interface SA05 - Customizing the User Interface
SA05 - Customizing the User Interface Maintenance Connection
 

Semelhante a Microsoft dynamics ax2012 : forms and tables methods call sequences, How To? (20)

20231013_274_ClubServicenow_Catalog.pdf
20231013_274_ClubServicenow_Catalog.pdf20231013_274_ClubServicenow_Catalog.pdf
20231013_274_ClubServicenow_Catalog.pdf
 
Creating a Great XPages User Interface
Creating a Great XPages User InterfaceCreating a Great XPages User Interface
Creating a Great XPages User Interface
 
Creating a Great XPages User Interface, TLCC Teamstudio Webinar - Feb, 2014
Creating a Great XPages User Interface, TLCC Teamstudio Webinar - Feb, 2014Creating a Great XPages User Interface, TLCC Teamstudio Webinar - Feb, 2014
Creating a Great XPages User Interface, TLCC Teamstudio Webinar - Feb, 2014
 
KWizCom forms - introduction
KWizCom forms - introductionKWizCom forms - introduction
KWizCom forms - introduction
 
Cis245 finalreview
Cis245 finalreviewCis245 finalreview
Cis245 finalreview
 
KWizCom Forms
KWizCom FormsKWizCom Forms
KWizCom Forms
 
Module 3 design and implementing tables
Module 3 design and implementing tablesModule 3 design and implementing tables
Module 3 design and implementing tables
 
SFDC Other Platform Features
SFDC Other Platform FeaturesSFDC Other Platform Features
SFDC Other Platform Features
 
Marty, You're Just Not Thinking Fourth Dimensionally
Marty, You're Just Not Thinking Fourth DimensionallyMarty, You're Just Not Thinking Fourth Dimensionally
Marty, You're Just Not Thinking Fourth Dimensionally
 
Jaspersoft and Clarity PPM - Advanced Reporting with Data Warehouse
Jaspersoft and Clarity PPM - Advanced Reporting with Data WarehouseJaspersoft and Clarity PPM - Advanced Reporting with Data Warehouse
Jaspersoft and Clarity PPM - Advanced Reporting with Data Warehouse
 
Implementing Tables and Views.pptx
Implementing Tables and Views.pptxImplementing Tables and Views.pptx
Implementing Tables and Views.pptx
 
Obiee metadata development
Obiee metadata developmentObiee metadata development
Obiee metadata development
 
LDV.pptx
LDV.pptxLDV.pptx
LDV.pptx
 
Oracle Forms: Introduction to multiple Forms
Oracle Forms: Introduction to multiple FormsOracle Forms: Introduction to multiple Forms
Oracle Forms: Introduction to multiple Forms
 
The Joy of Subforms with Randy Carey
The Joy of Subforms with Randy CareyThe Joy of Subforms with Randy Carey
The Joy of Subforms with Randy Carey
 
Refactoring
RefactoringRefactoring
Refactoring
 
DeVry UniversityStudent Lab ActivityBIS245 Database Essentials.docx
DeVry UniversityStudent Lab ActivityBIS245 Database Essentials.docxDeVry UniversityStudent Lab ActivityBIS245 Database Essentials.docx
DeVry UniversityStudent Lab ActivityBIS245 Database Essentials.docx
 
SA05 - Customizing the User Interface
SA05 - Customizing the User Interface SA05 - Customizing the User Interface
SA05 - Customizing the User Interface
 
Lightning Process Builder
Lightning Process BuilderLightning Process Builder
Lightning Process Builder
 
Lightning Process Builder
Lightning Process BuilderLightning Process Builder
Lightning Process Builder
 

Último

Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024SynarionITSolutions
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 

Último (20)

Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 

Microsoft dynamics ax2012 : forms and tables methods call sequences, How To?

  • 1. Microsoft Dynamics® AX 2012 Forms/tables methods call sequences
  • 2. Objectifs • Describe the methods call sequencing • Describe the forms and tables methods and when they should be override • Describe how to access form objects • Describe how to do some common tasks on forms
  • 4. Cases • Case 1: Form opening • Case 2: Record creation • Case 3: Field modification • Case 4: Record saving • Case 5: Record deletion • Case 6: Form closing • Case 7: RunBase
  • 6. Form Opening Form.init • Used to retrieve and validate the calling parameters • Initialize Controls : Visibility, Enable, Editable… • Do not put code that affects DS in this method use DS.init instead DS.init • Set Data Source properties : AllowEdit, AllowCreate, AllowDelete… • Create ranges, sorting and filters • Cache methods to improve performance • Not apply ranges values only if the ranges/links… are permanent
  • 7. Form Opening DS.linkActive • This methods is called every time we activate a new record on the calling form • Applying links, ranges and updating design depending on the caller record! DS.executeQuery • Applying ranges and filters values • Avoid changing the query structure (create ranges, links…) at this level as this method is frequently called DS.active • Updating design depending on the selected record • Updating other Data Sources queries
  • 9. Record creation DS.Create • Add supplementary rules to validate the creation • Modify creation process : example open a specific form for creation DS.initValue • Only to initialize fields with values that can not exists outside of the form, example : • Filter on the top of the form • Values coming from a calling form/class Table.initValue • Assign a default value to fields • Always call this method when creating records by X++ code even if the method is empty : It may be overridden in a future version!
  • 11. Field modification Control.validate - Control.Modified • never! DSField.validate • Validate the value typed / chosen by the user against business rules and data consistency DSField.modified • Modify value on other fields • Implement field modification rules When : code we want to implement is specific to the form, or depends on some data that are only available on the form Table.validateField, table.modifiedField Same as DS methods. These methods are called what ever the form.
  • 12. Field modification In modifiedField methods, you should always make sure that the code you have implemented will be cancelable if the user choose not save the changes he made. Else you have to force the saving of the record! Incorrect : Correct :
  • 13. Field modification Modifying a field value by X++ You should be sure the value you are assigning to the field respect business rules, as the system will not trigger a validateField method call automatically! Lookup consideration When you override the default lookup of a field to filter values that can be chosen by the user. You should always override validateField or validate to consider the case when the user type directly a value in the field without using the lookup.
  • 15. Record saving DS.validateWrite • Validate business rules and data consistency (mandatory fields filled…) that are form specific Table.validateWrite • Same as the DS equivalent but will be applied on all forms DS.Write • Updating other DS in the same form • Override the normal saving process with some specific rules Table.insert / Tables.update • Implement specific rules : CUD other record, recalculate a value…
  • 16. Record saving • When inserting/updating records by X++ code you should always call Table.validateWrite in order o validate business rules/ mandatory fields… Even if the method is empty! • Avoid direct call to doInsert/doUpdate, as all business rules that are written in insert/update are not executed. Only use direct call if : 1. Performance issues 2. You are sure that business rules implemented in insert/update are not applicable in your use case. Creation/update by X++ Code should be done using AxBC classes because they implement a Framework to correctly validate fields values and business rules. This will be discussed in an other session.
  • 18. Record deletion Delete Actions You should always remember to implement Delete Actions when your table is linked to other tables! Forgetting this can lead to data inconsistency. In X++ code you should always call Table.validateDelete before calling delete
  • 20. Form closing How to catch closing method of a form • ClosedOk : form has been closed using OK command button • ClosedCancel : form has been closed using a cancel command button or Esc • Closed : form has been closed “Normally”
  • 22. RunBase Main • Keep the code as minimum as possible • Used to retrieve and validate calling parameters, instantiate a class objects and initialize class object parameters Construct • Always create a construct method to encapsulate the new Method InitParmDefault • Use this method to default class variables/query with default values for the first class run by the user.
  • 24. How to acces form objects • FormRun : element, this • DataSource : DataSourceName_ds, this • Active Record : DataSourceName • DataSource Query : DataSourceName_q • DataSource Query Run : DataSourceName_qr • Field value : DataSourceName.Field • Control element.control(element.controlId(formControlStr(FormName, ControlName))) Or AutoDeclaration
  • 25. General rules • Do not place code in a form unless you cannot place it in a class or in a table method. • Code written on forms cannot be reused and is difficult to customize. • Forms are entirely client-based. There should be no code in them that manipulates the database. • Always Use Field Groups in Tables • To modify text that appears in the user interface you should modify property values on the extended data types or base enums in the application.
  • 26. General rules • If a control is linked to a field data source, You should never AutoDeclare this control. All behavior changes (visibility, mandatory, enable, …) can be done throw the data Source. Next slides shows you how you can do common tasks!
  • 27. How To ? How to enable/disable a control Incorrect : ControlName.enabled(true/false); Correct : DataSourceName_ds.object(fieldnum(Table, Field)).enabled(true/false); How to set visibility of a control Incorrect : ControlName.visible(true/false); Correct : DataSourceName_ds.object(fieldnum(Table, Field)).visible(true/false);
  • 28. How To ? How to make a control editable Incorrect : ControlName.allowEdit(true/false); Correct : DataSourceName_ds.object(fieldnum(Table, Field)).allowEdit(true/false); How to make a control mandatory Incorrect : ControlName.mandatory(true/false); Correct : DataSourceName_ds.object(fieldnum(Table, Field)).mandatory(true/false);
  • 29. How to? Assign a value to a control Incorrect Contol.text(value), control.realvalue(value), control. Checked(Value)… Correct DataSourceName.Field = Value;
  • 30. How to? Allow/prevent record creation/modification/deletion Creation • Propriety : AllowCreate • X++ : DataSourceName_ds.allowCreate() Modification • Propriety : AllowEdit • X++ : DataSourceName_ds.allowEdit() Deletion • Propriety : AllowDelete • X++ : DataSourceName_ds.allowDelete() NOT CORRECT Making Buttons that allow creation/modification/deletion disabled doesn’t prevent doing theses action. As there are shortcuts (Ctrl+N, Alt+F9…) that trigger the same events!
  • 31. How to? Cache methods (1) Method caching mechanism helps improve performances. DataSource_ds.cacheAddMethod(tableMethodStr(TableName, MethodName)); (1) Caching mechanism will be discussed in details in an other session.
  • 32. How to? Create/Apply range on a form DS 1. Declare a variable QueryBuildRange on classDeclaration 2. Create and assign the range in DS.init() after super() 3. Apply the range value in DS.executeQuery or DS.linkActive Add a filter control to a form (not listPage) 1. Declare a Range as previous 2. Declare a variable in class Declaration with desired type 3. Create an edit method on form methods on the declared variable 4. Call the DS.executeQuery() and use the variable as a value for the range 5. Create a control on the form using the edit method 6. Optional : Save the filter value by user by overriding methods In some cases you may have to use QueryFilter and not QueryBuildRange. See : - http://msdn.microsoft.com/en-us/library/hh745335.aspx - http://msdn.microsoft.com/en-us/library/gg881181.aspx
  • 33. How to? Add a filter control to a listPage 1. Turn the “Filter” group visible = Yes 2. Add a control to the group and specify properties : Label, helpText, CK… 3. Specify properties : 1. FilterDataSource : data source you want to filter 2. FilterField : field to filter based on it 3. FilterExpression : %1, !=%1, ..%1, %1.. A standard framework behind listPage will apply filter once a value is specified!
  • 34. Contact me Mohamed Amine HAMDAOUI mahamdaoui@toolconsulting.com www.toolconsulting.com Phone +212 (0) 6 69 42 79 94 Please don’t hesitate to contact me if you find any error on the document or if you have any questions. Thanks for your time, and see you in the next Lab!