When a Decision function returns False it always skips a sync. Therefore, when writing Decision function code, always refer to the Decision Function Checks and Considerations Table below.
Check |
Should the sync on the LUI be skipped? |
Consideration |
When defining a Decision function on the LU schema, the Decision function runs on every population in the LU schema. If the Decision function returns the same result for each population, it is recommended to set it on the Root Table’s population. Then invoke the skipSync() method in the Decision function code to skip the sync of the LUI if the conditions of the sync are not met. This way, Fabric performs a one-time execution of the Decision function on each LUI instead of executing the Decision function on each population. For example, setting the Decision functions to check whether the current time is during peak or off-peak hours. |
Fabric Function |
public static void skipSync() |
Click to go to the Decision Functions Overview.
Click for more information about Sync Modes.
Click for more information about Sync Behavior.
Click for more information about the Skip Sync Method.
Click to display a list of Fabric APIs: http://[Fabric IP address]:3213/static/doc/user-api/index.html
Example 1
Add a Decision function on the LU schema level to check the source environment and enable the sync of the LUI in the following scenarios:
// Init the Boolean by true\
Boolean syncInd = true;\
// Check the source environment\
String env = getActiveEnvironmentName();
// If the active environment is not production, this sync is not the first sync of the instance, and the schema is not changed => do not sync the instance\
if(!env.toLowerCase().equals("prod") && !isFirstSync() && !isStructureChanged())\
syncInd = false;
// DEBUG- note- the output of getTableName() was added to the log, since when setting
// a decision function on the LU schema- it runs on each population of every LU table of the
// schema if all tables are inherited from the schema
log.info("fnCheckSourceEnv- table name: " + getTableName() + ", active env: " + env.toLowerCase() + ", isFirstSync: " + isFirstSync() +
", isStructureChanged: " + isStructureChanged() + ", Sync indicator: " + syncInd.toString());\
return syncInd;
Example 2
Add a Decision function on the population level in an LU table which is populated only when run on a Development source environment. When run on a Production environment, do not populate this table, since this table does not exist in the Production DB.
// Init the Boolean by true\
Boolean syncInd = true;
// Check the product version (application version) global. Populate ACTIVITY table only of the source version is 'dev'\
String prodVer = SOURCE_PRODUCT_VERSION;
if(!prodVer.toLowerCase().equals("dev") )\
syncInd = false;
// DEBUG
log.info("fnCheckSourceVersion- product version: " + prodVer + ", isFirstSync: " + isFirstSync() + ", isStructureChanged: " + isStructureChanged() + ", Syc indicator: " + syncInd.toString());
return syncInd;
Example 3
Add a Decision function on the CASE LU table to check if the CONTRACT LU table has been updated. The check is based on a session level Global (key) which is set to True by the population of the CONTRACT LU table.
// Init the Boolean by true\
Boolean syncInd = true;\
// Check the UPDATE_CONTRACT session level key.\
syncInd = UPDATE_CONTRACT ;\
return syncInd;
Example 4
Add a Decision function on the LU schema level to check if the current time is during peak hours or if this sync is the first sync of the LUI. If the current time is during peak hours and the instance already exists in Fabric, skip the sync of the LUI.
Boolean syncInd = false;\
Boolean offPeak=true;\
LocalTime start = LocalTime.parse( "09:00:00" );\
LocalTime end = LocalTime.parse( "17:00:00" );\
LocalTime now = LocalTime.now();
if(now.isAfter(start) && now.isBefore(end))\
offPeak=false;
if(isFirstSync() || offPeak)\
syncInd = true;
// DEBUG\
log.info("now: " + now.toString()+ ", is offPeak: " + offPeak + ", now: " + now.toString() + " , isFirstSync(): " + isFirstSync() + " sync ind: " + syncInd);
if(!syncInd)\
skipSync();
return syncInd;
Note that the fnCheckSourceEnv, fnCheckSourceVersion, and fnCheckOffPeak functions are displayed in the Demo Fabric Project under the Java tab under the CRM LU folder.
When a Decision function returns False it always skips a sync. Therefore, when writing Decision function code, always refer to the Decision Function Checks and Considerations Table below.
Check |
Should the sync on the LUI be skipped? |
Consideration |
When defining a Decision function on the LU schema, the Decision function runs on every population in the LU schema. If the Decision function returns the same result for each population, it is recommended to set it on the Root Table’s population. Then invoke the skipSync() method in the Decision function code to skip the sync of the LUI if the conditions of the sync are not met. This way, Fabric performs a one-time execution of the Decision function on each LUI instead of executing the Decision function on each population. For example, setting the Decision functions to check whether the current time is during peak or off-peak hours. |
Fabric Function |
public static void skipSync() |
Click to go to the Decision Functions Overview.
Click for more information about Sync Modes.
Click for more information about Sync Behavior.
Click for more information about the Skip Sync Method.
Click to display a list of Fabric APIs: http://[Fabric IP address]:3213/static/doc/user-api/index.html
Example 1
Add a Decision function on the LU schema level to check the source environment and enable the sync of the LUI in the following scenarios:
// Init the Boolean by true\
Boolean syncInd = true;\
// Check the source environment\
String env = getActiveEnvironmentName();
// If the active environment is not production, this sync is not the first sync of the instance, and the schema is not changed => do not sync the instance\
if(!env.toLowerCase().equals("prod") && !isFirstSync() && !isStructureChanged())\
syncInd = false;
// DEBUG- note- the output of getTableName() was added to the log, since when setting
// a decision function on the LU schema- it runs on each population of every LU table of the
// schema if all tables are inherited from the schema
log.info("fnCheckSourceEnv- table name: " + getTableName() + ", active env: " + env.toLowerCase() + ", isFirstSync: " + isFirstSync() +
", isStructureChanged: " + isStructureChanged() + ", Sync indicator: " + syncInd.toString());\
return syncInd;
Example 2
Add a Decision function on the population level in an LU table which is populated only when run on a Development source environment. When run on a Production environment, do not populate this table, since this table does not exist in the Production DB.
// Init the Boolean by true\
Boolean syncInd = true;
// Check the product version (application version) global. Populate ACTIVITY table only of the source version is 'dev'\
String prodVer = SOURCE_PRODUCT_VERSION;
if(!prodVer.toLowerCase().equals("dev") )\
syncInd = false;
// DEBUG
log.info("fnCheckSourceVersion- product version: " + prodVer + ", isFirstSync: " + isFirstSync() + ", isStructureChanged: " + isStructureChanged() + ", Syc indicator: " + syncInd.toString());
return syncInd;
Example 3
Add a Decision function on the CASE LU table to check if the CONTRACT LU table has been updated. The check is based on a session level Global (key) which is set to True by the population of the CONTRACT LU table.
// Init the Boolean by true\
Boolean syncInd = true;\
// Check the UPDATE_CONTRACT session level key.\
syncInd = UPDATE_CONTRACT ;\
return syncInd;
Example 4
Add a Decision function on the LU schema level to check if the current time is during peak hours or if this sync is the first sync of the LUI. If the current time is during peak hours and the instance already exists in Fabric, skip the sync of the LUI.
Boolean syncInd = false;\
Boolean offPeak=true;\
LocalTime start = LocalTime.parse( "09:00:00" );\
LocalTime end = LocalTime.parse( "17:00:00" );\
LocalTime now = LocalTime.now();
if(now.isAfter(start) && now.isBefore(end))\
offPeak=false;
if(isFirstSync() || offPeak)\
syncInd = true;
// DEBUG\
log.info("now: " + now.toString()+ ", is offPeak: " + offPeak + ", now: " + now.toString() + " , isFirstSync(): " + isFirstSync() + " sync ind: " + syncInd);
if(!syncInd)\
skipSync();
return syncInd;
Note that the fnCheckSourceEnv, fnCheckSourceVersion, and fnCheckOffPeak functions are displayed in the Demo Fabric Project under the Java tab under the CRM LU folder.