Professional Documents
Culture Documents
Flex Fields
Document Title: Flex Fields Technical Specification document
Document Approvals:
Date Approver Name Role Approval Status (Pending,
In Review, Approved)
Sudhakar Senior Manager
Content
1 Introduction................................................................................................................6
1.1 Dependencies..........................................................................................................................6
1.2 Goals.......................................................................................................................................6
1.3 Non-goals................................................................................................................................6
1.4 Assumptions............................................................................................................................6
2 References.................................................................................................................7
3 Architecture Overview..............................................................................................8
4 Solution Overview.....................................................................................................9
4.1.1 Implementation Approach...............................................................................................9
4.1.2 Alternate approaches considered along with analysis....................................................9
5 Design Overview.....................................................................................................10
5.1 Design Principles..................................................................................................................10
5.2 Design Model........................................................................................................................10
5.3 Design Patterns Used............................................................................................................10
6 Database Layer........................................................................................................11
6.1 Schema..................................................................................................................................11
6.2 ETL Design...........................................................................................................................17
6.3 Dataset Design......................................................................................................................17
6.4 Naming Conventions:...........................................................................................................17
6.5 Flex XML Schema:...............................................................................................................17
6.5.1 Things to note about flex XML.....................................................................................17
6.5.2 Example Flex XML for AddUpdate operation..............................................................18
6.5.3 Example Flex XML for Search operation.....................................................................18
6.5.4 Example Flex XML for Get operation...........................................................................19
6.6 TI Design...............................................................................................................................19
6.7 Common Data Cache............................................................................................................19
6.8 Database Triggers.................................................................................................................19
6.9 Workflow Events..................................................................................................................19
6.10 Common Libraries/APIs....................................................................................................20
7 Presentation Layer..................................................................................................21
7.1 Menu/Sitemap.......................................................................................................................21
7.2 Common Controls/Libraries.................................................................................................21
7.2.1 Class: ObjFieldDefinition..............................................................................................21
7.2.2 Class: ObjFlexFieldDisplay...........................................................................................21
7.2.3 Class: ObjFlexFormBinder............................................................................................21
7.3 Master Pages/Templates.......................................................................................................21
7.4 Style Sheets/Skins.................................................................................................................21
7.5 Pages.....................................................................................................................................22
7.5.1 Add/Update Pages.........................................................................................................22
7.5.2 Search UI.......................................................................................................................22
7.5.3 Grid/List UI...................................................................................................................23
7.5.4 Summary UI...................................................................................................................24
7.5.5 JavaScript: Page function modifications.......................................................................25
7.6 Master Page Reference..........................................................................................................25
7.7 Skin/StyleSheet Reference....................................................................................................25
7.8 Control Reference.................................................................................................................25
7.9 Controllers.............................................................................................................................25
8 Service Layer...........................................................................................................26
8.1 Services Contract..................................................................................................................26
8.2 Web Services Design............................................................................................................26
8.3 DataTransfer Objects............................................................................................................26
8.4 Scheduled Jobs......................................................................................................................26
8.5 Cache.....................................................................................................................................26
8.6 Common Libraries................................................................................................................27
9 Data Access Layer..................................................................................................28
9.1 ORM......................................................................................................................................28
9.2 Stored Procedure APIs..........................................................................................................28
9.2.1 New Stored Procedures.....................................................................................................28
9.2.2 Modifications to Stored Procedures:.................................................................................30
9.3 Considerations for Flex fields support in Activity:...............................................................33
9.4 Transaction Scope/Management...........................................................................................33
10 Integrations..............................................................................................................34
11 Impact of Existing Process....................................................................................35
11.1 Notifications......................................................................................................................35
11.2 Upgrade.............................................................................................................................35
12 Design Foundation..................................................................................................36
12.1 Performance and Scalability..............................................................................................36
12.2 Security..............................................................................................................................36
12.3 Globalization.....................................................................................................................36
12.4 Diagnosis and Supportability............................................................................................36
12.5 Setup and Deployment......................................................................................................36
12.6 508 Support.......................................................................................................................37
12.7 Hosting Update..................................................................................................................37
12.8 Backward Compatibility....................................................................................................37
12.9 Third party.........................................................................................................................37
13 Unit Test Plan..........................................................................................................38
14 APPENDIX................................................................................................................39
14.1 Products and tools Used....................................................................................................39
14.2 Future Enhancements........................................................................................................39
14.3 Design Issues.....................................................................................................................39
15 Traceability Matrix...................................................................................................40
1 Introduction
Flex fields denotes flexible fields support for core entities in LMS. By flexible fields we mean the
ability to add new fields on the core entities. Flex fields allow the object to be extended with
additional information as per the needs of the customer. Flex fields will be available in the LMS
system as part of the data import options, UI display and form, data list pages and object search
functionality. However, they do not participate in the business rules and business logic associated
with the LMS.
1.1 Dependencies
None
1.2 Goals
1.3 Non-goals
1.4 Assumptions
None
2 References
These tables store the flex fields data for the entity. Table naming convention is
<coretablename>Ex. For example, to store data for flex fields for employee (tblEmp), the table
would be named tblEmpEx
The table consists of following columns:
o Str1, Str2, Str3,… Int1, Int2, Int3,… Bool1, Bool2, Bool3,… Date1, Date2, Date3,…
Decimal1, Decimal2, Decimal3,… Float1, Float2, Float3
The columns are fixed in number for each type of flex field that would be supported.
The string columns are of type nvarchar(max) on SQL Server and CLOB on Oracle. They have
full text indexing enabled.
The integer and date columns need to have indexes created on them to enable search.
At least one of the attribute ‘id’ or ‘key’ must be supplied for the <object> and <field> elements.
If both are supplied, the id value takes precedence.
The element <object> inside the <field> element is used to expand the field when it is of
complex type such as lookup value. This may be required when returning the flex XML in a Get
operation and the flex lookup values need to be expanded.
During the search operation on flex fields, the ‘search’ attributes for the <field> element is used
to specify the search path and function to be used. The path can be one of the values ‘id’, ‘name’
or ‘description’ and is only relevant in case the field is of type lookup. The functions can be ‘eq’,
‘gt’, ‘ge’, ‘lt’, ‘le’ or ‘contains’. The inner element <value> can be string, int, bool, etc. for in
case of lookup values the id or the text depending on the path that was specified. There is no
provision in the XML to specify ‘AND’ or ‘OR’ between the flex field expressions. This is
because AND operation is assumed in case multiple flex field search values are specified.
<!CDATA[[]]> element inside the <value> can be used in case the value is string and contains
special characters such as ‘<’ or ‘>’. However if the ‘value’ attribute is specified, it takes
precedence over the child element <value>.
Please note that the flex xml itself does not contain any metadata about the flex field definitions.
This is intentional since the flex field metadata is anyways stored in the metadata tables and
could be queried separately. Also, storing metadata along with the data will bloat the XML and
lead to performance issues. However, during the Get operation ‘data-type’ attribute can be sent
for the <field> element to avoid an additional lookup to cast the value in UI to appropriate type.
‘data-type’ values can be one of int, string, bool, datetime, float, decimal and lookup.
For money type of flex fields an additional attribute ‘currencyid’ can be specified for the <flex>
element to denote the currency associated with the flex field of type decimal.
This xml is passed to the AddUpdate stored procedure as the last parameter. The stored procedure
then parses the XML and stores the data in a relational extension table for the entity. Note that for
lookup type of flex field called ‘Award’ the <object> element is used to specify the value.
6.5.3 Example Flex XML for Search operation
<object key=”job”>
<field key=”SSN” search-op=”contains”>
<value><!CDATA[[ AB* ]]></value>
</field>
<field key=”Salary” search-op=”gt” value=”10000” />
<field key=”AdditionalNotes” search-op=”contains”>
<value><!CDATA[[“add*”]]></value>
</field>
<field key=”Award” search-op=”eq” search-path=”id”>
<value><!CDATA[[1]]></value>
</field>
</object>
This xml is passed to the search stored procedure as the last parameter. The stored procedure then
parses the XML and uses the data to populate temp table with object PKs that match the supplied
criteria. Note that for flex field ‘Award’ which is of type lookup, the search path has been specified
as ‘id’ and the value denotes the id value to be matched.
This xml is passed as the last column in the selected Recordset in the Get procedure. The xml itself
is created by a SQL function that reads entity extension table and metadata table for flex fields and
returns the flex XML. Note that for lookup type ‘Award’ the <field> element contains <object>
element that contains the ‘id’ value as well as the ‘Name’ value that could be used by the caller for
display purposes. The value itself is returned as per the preferred language of the user.
6.6 TI Design
For TI, there is an additional requirement. TI uses property names to identify the fields to import
from flat files. The property names should hence be unique. Hence unique constraint needs to be
ensured on the KeyName and Name columns in the Meta_Entity and Meta_EntityProperty tables.
Changes in TI to support Flex fields will be added as part of a separate design document.
6.7 Common Data Cache
There are no changes or additions for cache tables in LMS for supporting flex fields.
Each method should display the label (localized) as well as the form input element or text for the
flex field. Translations for the label are returned from Metadata SP that returns entity definition and
its translations (stored in database in the *Desc tables).
1. EditFor – method to create XML for AddUpdate operation from submitted form values.
2. SearchFor – method to create XML for search operation from submitted form values.
The above methods also validate the input to confirm that submitted data was as per the field
definitions and with valid values.
7.5 Pages
Pages in LMS are broadly categorized in multiple types based on the functionality provided.
Add/Update pages allow creation or updation of entities while Summary pages allow to see brief
summary of entities important properties. The List pages show the search results of entities in a data
grid while the search popup show searchable fields for the entity.
7.5.2 Search UI
1. Show flex fields after core fields where IsSearchable=true (displayed in the end). Done by
ObjFlexFieldDisplay.SearchFor method)
2. Create a new JavaScript function in SYS_Util.js that creates XML from flex fields in the
advanced search popup UI before returning to caller page
3. Submit form from caller page (use POST instead of GET wherever GET is being used)
7.5.3 Grid/List UI
1. Flex field is visible in data grid if IsListable=true in object field metadata (displayed in the end).
Done by ObjFlexFieldDisplay.ListFor method.
2. Use Grid event handlers that use custom XML to render the flex field in data grid
7.5.4 Summary UI
1. Show flex fields that have IsInSummary=true in the object metadata (displayed in the end).
Done by ObjFlexFieldDisplay.SummaryFor method.
7.5.5 JavaScript: Page function modifications
The page JavaScript function for validation should raise alert message in user’s preferred language
in case a flex field is mandatory and not supplied before submitting form data, or when the input text
does not match the actual field type. The modifications in page and JavaScript file would be similar
as done for domain settings extension.
7.9 Controllers
No changes
8 Service Layer
Metadata Service class will be created to expose the metadata definitions. Other than this, no other
service is required since the existing stored procedures are leveraged to add/update, get, search and
delete the entities. The service class will not be hosted as a service but directly leveraged in the web
application layer as an assembly.
8.5 Cache
The supplemental data cache needs to be extended to also cache the lookup types since they need to
be displayed as a combo box with translated lookup values in the UI. The
ObjFlexFieldDisplay.EditFor and ObjFlexFieldDisplay.SearchFor methods will use the
supplemental cache to get the values and render the combo box.
In addition to lookup types, the flex field definitions also need to be cached. The field definitions
contain not only the metadata for flex fields but also the translated labels for these fields in all
supported languages. This cache can be a simple Hashtable lookup.
Cache will be populated on request and need basis. It never expires once cached. An alternate
approach would be repopulate the cached item from database if its duration in cache is longer than
few minutes and if it was currently requested.
Note: There is no stored procedure to add, update or delete lookup values since there is no UI being
developed to manage lookup values. If there is a UI requirement, the appropriate stored procedures
to AddUpdate, Delete and Get for lookup values need to be created similar to existing supplemental
data infrastructure (for example Delivery Methods or Content Types).
%%TRANSACTION
{
%%ON_ERROR
{
%%RETURN { 1 }
%%ROLLBACK{ Error ocurred while AddUpdateUser}
%%RAISE { exception_addUpdateUser }
}
… Core logic to insert records into core tables
… Get all active custom procedures that exist for AddUpdate in the procedure metadata table, call them for
saving flex fields (pass all parameters as the core procedure)
… Get all active custom procedures that exist for Search in the procedure metadata table, call them one by one
(pass all parameters as the core procedure). This results in the population of object PKs in the temp table matching flex
criteria
… Core logic to paginate with extra left outer join on temp table
… left outer join #temp t on t.PK = emp.emp_PK and @i_flexFieldsSearched=1
Select core fields + flex fields XML column from core table (flex fields XML is returned via a function call)
}
}
Select core fields + flex fields XML column from core table (flex fields XML is returned via a function call)
}
}
1. AddUpdate support for flex fields – The property bag implementation should be enhanced to
read the flex fields for entity and based on the group, display those fields also for editing (at the
end of the page). The display of the elements is done via the ObjFlexFieldRenderer object like
for other objects. This takes care of emitting the JavaScript for validation of the fields also. The
ObjFlexFieldFormManager would be used in the staging editor to capture the flex field form
values and form the XML. This XML would be passed to the procedure responsible for saving
activity properties in the database. The procedure would be modified as indicated in previous
sections to validate the flex XML and insert data into custom table (TBL_TMX_ActivityEx).
This table should follow the same principle as the core table that uses negative PK values to
identify the records in staging vs. those in production.
2. Search support for flex fields – The ListActivities procedure will take the Flex XML as
parameter and follow similar approach as mentioned above to populate a temp table and join this
table for search results including core and flex fields. However, care needs to be taken to handle
the staging and production records (as per the core functionality).
3. Display of flex fields in staging editor – The property bag implementation checks for flex fields
using Metadata in database for the activity group and renders the fields using
ObjFlexFieldRenderer. If activity is in staging, textbox in edit mode is displayed (EditFor
method) else the fields are displayed using DisplayFor method.
4. List activities in data grid – Follows similar method as listed above for other entities.
11.1 Notifications
Flex fields to be made available in notification templates will be done via extensions in notifications.
This is covered as part of notifications extensibility design document.
11.2 Upgrade
On the database side, tables, stored procedures and system data needs to be installed. No upgrade
cost here. On the UI side, new assemblies, pages, and configuration will be available. Even in this
case upgrade is simple enough. However, once flex field support is installed, upgrading database and
web needs to be considered carefully as it may lead to flex fields not working as expected or data
being corrupted.
12 Design Foundation
The following sections describe the concepts that support the design, or the system foundation.
These sections include concepts such as performance, security, and globalization. Detail should
be included in these sections to show that they were considered during the design process and
considerations for them are accounted for.
12.2 Security
Scripting attacks are eliminated since the core UI display library functions are used for displaying
HTML. Dynamic SQL should be avoided in the new SQL functions of stored procedures that are
required for flex fields as it exposes SQL injection vulnerability
12.3 Globalization
The flex field property labels would come from the flex field definition cache. The lookup
translations come from the supplemental cache. JavaScript alert messages and error messages would
be stored in the RESX resource manager of web site. Naming convention for the resource classes
would be L_Flex_[ObjectKey].ResourceName for resources specific to the object. For common to
flex fields, L_Flex_Common.ResourceName