Question

FSM mobile not syncing


Badge +2

I am having a weird issue where a custom screen using a client script on the next button does not want to sync.

I know the client script runs due to the alert at the end of the code. Before, if something does not sync, I would get an error on the sync screen. Now, however, I do not even get an error. No syncs waiting to happen, no errors, no warnings. Is there anyone that could spend some time with me in teams to help me out with this?


11 replies

Badge +2

Ah ok. I did look at the log before setting it to log level 9. Still, there are no other errors I understand in the log. I am starting to think I should try doing this on another environment or server to check if it works there, because none of the custom screens in this environment tries to sync anymore.

Userlevel 5
Badge +15

That error was resolved yesterday when I was trying different things out of desperation. The date on it is 11/24/21. Only errors dated today should be relevant.

You can further do the checks on your script by downloading the server log as a method of troubleshooting so that you can further analyze what has caused the issues, that’s what I wanted to simply highlight here :slight_smile:

Badge +2

@Saranga Amaraweera 

That error was resolved yesterday when I was trying different things out of desperation. The date on it is 11/24/21. Only errors dated today should be relevant.

Userlevel 5
Badge +15

Hi @Fluffy ,

You might need to check on below errors in your script

[Script ID: CAPTURE_VEHICLE_DETAILS_NEXT, v1] Exception: Attempted to get the value for variable (curPlaceId), but the variable was not found.
no such column: place_id_cust (code 1): , while compiling: select place_id_cust from place where task_id = '402'

android.database.sqlite.SQLiteException: near "=": syntax error (code 1): , while compiling: UPDATE place SET name=?,USER_DEF3=?,place_id=?,whos_place=?,metrix_row_id=?,USER_DEF5=? WHERE metrix_row_id =

Exception: [Script ID: CAPTURE_VEHICLE_DETAILS_NEXT, v1] Exception: Attempted to get the value for variable (vehicleYear), but the variable was not found.

Badge +2

K here it is

Userlevel 5
Badge +15

Hello @Fluffy ,

Could you attach the log as a document in this thread?

Badge +2

Here are some extracts from the error log after doing what you suggested and trying the process again:

11/25/21 04:45:16 AM|ERROR|com.metrix.architecture.utilities.MetrixActivityHelper:createActivityIntent|main|java.lang.ClassNotFoundException: com.metrix.metrixmobile.ApplicationSettings
    at java.lang.Class.classForName(Native Method)
    at java.lang.Class.forName(Class.java:400)
    at java.lang.Class.forName(Class.java:326)
    at com.metrix.architecture.utilities.MetrixActivityHelper.createActivityIntent(MetrixActivityHelper.java:231)
    at com.metrix.architecture.utilities.MetrixActivityHelper.createActivityIntent(MetrixActivityHelper.java:192)
    at com.metrix.metrixmobile.OptionsMenu.onOptionsItemSelected(OptionsMenu.java:253)
    at com.metrix.metrixmobile.system.MetrixActivity.onSlidingMenuItemClick(MetrixActivity.java:4350)
    at com.metrix.architecture.slidingmenu.MetrixSlidingMenuAdapter$SlidingMenuVH$1.onClick(MetrixSlidingMenuAdapter.java:89)
    at android.view.View.performClick(View.java:5638)
    at android.view.View$PerformClick.run(View.java:22430)
    at android.os.Handler.handleCallback(Handler.java:751)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6198)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:891)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:781)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.metrix.metrixmobile.ApplicationSettings" on path: DexPathList[[zip file "/system/framework/com.google.android.maps.jar", zip file "/data/app/com.metrix.metrixmobile-1/base.apk"],nativeLibraryDirectories=[/data/app/com.metrix.metrixmobile-1/lib/x86, /data/app/com.metrix.metrixmobile-1/base.apk!/lib/x86, /system/lib, /vendor/lib]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
    ... 17 more


11/25/21 04:45:23 AM|ERROR|com.metrix.metrixmobile.system.SyncServiceMonitor:populateErrorList|main|java.lang.NullPointerException: Attempt to invoke virtual method 'android.widget.TabWidget android.widget.TabHost.getTabWidget()' on a null object reference
    at com.metrix.metrixmobile.system.SyncServiceMonitor.populateErrorList(SyncServiceMonitor.java:1114)
    at com.metrix.metrixmobile.system.SyncServiceMonitor.onCreate(SyncServiceMonitor.java:145)
    at android.app.Activity.performCreate(Activity.java:6692)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2621)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2729)
    at android.app.ActivityThread.-wrap12(ActivityThread.java)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1480)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6198)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:891)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:781)


11/25/21 04:45:23 AM|ERROR|com.metrix.architecture.designer.MetrixScreenManager:getScreenProperties|main|java.lang.Exception: getScreenProperties: No screen(ID:-1) metadata found!
    at com.metrix.architecture.designer.MetrixScreenManager.getScreenProperties(MetrixScreenManager.java:513)
    at com.metrix.architecture.designer.MetrixScreenManager.setLabelTipAndHelp(MetrixScreenManager.java:310)
    at com.metrix.architecture.designer.MetrixScreenManager.setLabelTipAndHelp(MetrixScreenManager.java:296)
    at com.metrix.metrixmobile.system.MetrixActivity.onStart(MetrixActivity.java:620)
    at com.metrix.metrixmobile.system.SyncServiceMonitor.onStart(SyncServiceMonitor.java:251)
    at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1248)
    at android.app.Activity.performStart(Activity.java:6709)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2631)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2729)
    at android.app.ActivityThread.-wrap12(ActivityThread.java)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1480)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6198)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:891)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:781)


11/25/21 04:45:23 AM|ERROR|com.metrix.architecture.designer.MetrixScreenManager:getScreenProperties|main|java.lang.Exception: getScreenProperties: No screen(ID:-1) metadata found!
    at com.metrix.architecture.designer.MetrixScreenManager.getScreenProperties(MetrixScreenManager.java:513)
    at com.metrix.architecture.designer.MetrixScreenManager.getScriptDefForScreenRefresh(MetrixScreenManager.java:257)
    at com.metrix.metrixmobile.system.MetrixActivity.runScreenRefreshScriptEvent(MetrixActivity.java:738)
    at com.metrix.metrixmobile.system.MetrixActivity.onStart(MetrixActivity.java:658)
    at com.metrix.metrixmobile.system.SyncServiceMonitor.onStart(SyncServiceMonitor.java:251)
    at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1248)
    at android.app.Activity.performStart(Activity.java:6709)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2631)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2729)
    at android.app.ActivityThread.-wrap12(ActivityThread.java)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1480)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6198)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:891)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:781)


11/25/21 04:56:44 AM|ERROR|com.metrix.architecture.database.MetrixSQLiteDatabaseAdapter:insertRow|main|Database InsertRow Caught Exception in table place_log column 'USER_DEF3' is invalid

11/25/21 04:56:49 AM|ERROR|com.metrix.architecture.utilities.MetrixActivityHelper:createActivityIntent|main|java.lang.ClassNotFoundException: com.metrix.metrixmobile.ApplicationSettings
    at java.lang.Class.classForName(Native Method)
    at java.lang.Class.forName(Class.java:400)
    at java.lang.Class.forName(Class.java:326)
    at com.metrix.architecture.utilities.MetrixActivityHelper.createActivityIntent(MetrixActivityHelper.java:231)
    at com.metrix.architecture.utilities.MetrixActivityHelper.createActivityIntent(MetrixActivityHelper.java:192)
    at com.metrix.metrixmobile.OptionsMenu.onOptionsItemSelected(OptionsMenu.java:253)
    at com.metrix.metrixmobile.system.MetrixActivity.onSlidingMenuItemClick(MetrixActivity.java:4350)
    at com.metrix.architecture.slidingmenu.MetrixSlidingMenuAdapter$SlidingMenuVH$1.onClick(MetrixSlidingMenuAdapter.java:89)
    at android.view.View.performClick(View.java:5638)
    at android.view.View$PerformClick.run(View.java:22430)
    at android.os.Handler.handleCallback(Handler.java:751)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:6198)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:891)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:781)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.metrix.metrixmobile.ApplicationSettings" on path: DexPathList[[zip file "/system/framework/com.google.android.maps.jar", zip file "/data/app/com.metrix.metrixmobile-1/base.apk"],nativeLibraryDirectories=[/data/app/com.metrix.metrixmobile-1/lib/x86, /data/app/com.metrix.metrixmobile-1/base.apk!/lib/x86, /system/lib, /vendor/lib]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
    ... 17 more


 

Badge +2

I have no idea how to do that. Where do I set the log levels in the smart client?

Edit: Ok found it.

Userlevel 5
Badge +15

Hi @Fluffy ,

Please increase the log levels of mobile log (set exception level to 9) in smart client and try to re-initialize the mobile application. Then save the mobile log and check whether there is an issue in your log.

There should be something incorrect (most likely a syntax error or unexpected result) in your client script. Normally, the dataload won’t sync as expected in case if you have issues in client scripts.

Badge +2

So I change the vin number on my mobile screen and click the next button that this script is attached to.

 

// FUNCTION : Next Button for Site Access Screen
// Reading the values from the screen

var curTaskID = getCurrentKeys("task", "task_id");

var curPlaceIDRec = getDBValues(stringFormat("select place_id_cust from task where task_id = '{0}'", curTaskID));
alert(curPlaceIDRec[0]);
var curPlaceID;
if (curPlaceIDRec != null)
        {
            var row = curPlaceIDRec[0];
            if (row != null)
            {
                // Place ID
                curPlaceID = row["place_id_cust"];
            }
        }
//alert(curPlaceID);

var vehicleVin = getControlValue("place", "USER_DEF3");
var vehicleMake = getControlValue("place", "USER_DEF5");
var vehicleModel = getControlValue("place", "USER_DEF6");
var vehicleYear = getControlValue("place", "USER_DEF7");
var vehicleColour = getControlValue("place", "USER_DEF8");

// Validate any values changed on Screen
if (initialValuesHaveChanged())
{
   
    // If any of Site Access values have changed
    if (vehicleVin != null || vehicleMake != null || vehicleModel != null || vehicleYear != null || vehicleColour != null)
    {
        var cPlaceName, cPlaceWhoseplace;
        var getPlaceProp = getDBValues(stringFormat("select name,whos_place from place where place_id = '{0}'", curPlaceID));
        if (getPlaceProp != null)
        {
            var row = getPlaceProp[0];
            if (row != null)
            {
                // Place Name
                cPlaceName = row["name"];
                // Whose Place
                cPlaceWhoseplace = row["whos_place"];
            }
        }
        alert(curPlaceID);
       
        // Save the Place updates into a DB Transaction
        // Read the metrix row ID for the place record
        rowId = getDBValue(stringFormat("select metrix_row_id from place where place_id = '{0}'", curPlaceID));
        
        var placeUpdTrans = generateDataTransaction("place", "UPDATE", stringFormat("metrix_row_id = {0}", rowId));
        placeUpdTrans = addToDataTransaction(placeUpdTrans, "metrix_row_id", rowId);
        placeUpdTrans = addToDataTransaction(placeUpdTrans, "place_id", curPlaceID);
        
        placeUpdTrans = addToDataTransaction(placeUpdTrans, "name", cPlaceName);
        placeUpdTrans = addToDataTransaction(placeUpdTrans, "whos_place", cPlaceWhoseplace);
      
            
        placeUpdTrans = addToDataTransaction(placeUpdTrans, "USER_DEF3", vehicleVin);
        
       
       
        placeUpdTrans = addToDataTransaction(placeUpdTrans, "USER_DEF5", vehicleMake);
           
           
            //alert(cPlaceWhoseplace);
           
        
        
         
        saveDataTransaction(placeUpdTrans, getMessage("Place", "LABEL"));
        
        setControlValue("place", "USER_DEF3",vehicleVin);
        saveChanges();
        // Advance to next screen
        //advanceWorkflow();
        alert(curPlaceID);
    } 
    else 
    {
        alert(getMessage("PopulateAllRequiredFields", "INFORMATION"));
    }
}

Here are my sync rules for place:

<hierarchy_select return_only_requested_attrs="true" max_rows="50000">
  <primary_table>PLACE</primary_table>
  <from>
    <table>PLACE</table>
    <table>PERSON</table>
  </from>
  <attrs>
    <attr>PLACE.PLACE_ID</attr>
    <attr>PLACE.WHOS_PLACE</attr>
    <attr>PLACE.GLOBAL_NAME</attr>
    <attr>PLACE.NAME</attr>
    <attr>PLACE.EMAIL_ADDRESS</attr>
    <attr>PLACE.GEOCODE_LAT</attr>
    <attr>PLACE.GEOCODE_LONG</attr>
    <attr>PLACE.TRAVEL_ZONE</attr>
    <attr>PLACE.TIME_ZONE</attr>
    <attr>PLACE.PHONE</attr>
    <attr>PLACE.IDL_OFFSET</attr>
    <attr>PLACE.OBSERVES_DST</attr>
    <attr>PLACE.CURRENCY</attr>
    <attr>PLACE.LOCALE_CODE</attr>
    <attr>PLACE.STATUS_CONDITION</attr>
    <attr>PLACE.HOLD_CONDITION</attr>
    <attr>PLACE.CREDIT_HOLD</attr>
    <attr>PLACE.PLACE_TYPE</attr>
    <attr>PLACE.PLACE_GROUP</attr>
    <attr>PLACE.PLACE_CLASS</attr>
    <attr>PLACE.PLACE_CATEGORY</attr>
    <attr>PLACE.PHY_SVC_GRP_A</attr>
    <attr>PLACE.PHY_SVC_GRP_B</attr>
    <attr>PLACE.PHY_SVC_GRP_C</attr>
    <attr>PLACE.PHY_SVC_GRP_D</attr>
    <attr>PLACE.PHY_SVC_GRP_E</attr>
    <attr>PLACE.ALLOW_PRODUCTS</attr>
    <attr>PLACE.STOCK_PARTS</attr>
    <attr>PLACE.CREDIT_STATUS</attr>
    <attr>PLACE.BLANKET_PO</attr>
    <attr>PLACE.PO_REQUIRED</attr>
    <attr>PLACE.PART_ADJ_PCT</attr>
    <attr>PLACE.LABOR_ADJ_PCT</attr>
    <attr>PLACE.TRAVEL_ADJ_PCT</attr>
    <attr>PLACE.ACCOUNT_STATUS</attr>
    <attr>PLACE.CRITICAL_ACCOUNT</attr>
    <attr>PLACE.BILLING_PLACE</attr>
    <attr>PLACE.SHIP_TO_PLACE</attr>
    <attr>PLACE.STATUS</attr>
    <attr>PLACE.WEB_ADDRESS</attr>
    <attr>PLACE.PHONE</attr>
    <attr>PLACE.SATISFACTION</attr>
    <attr>PLACE.PRIORITY</attr>
    <attr>PLACE.GEOCODE_LAT</attr>
    <attr>PLACE.GEOCODE_LONG</attr>
<attr>PLACE.USER_DEF3</attr>
 <attr>PLACE.USER_DEF4</attr>
 <attr>PLACE.USER_DEF5</attr>
 <attr>PLACE.USER_DEF6</attr>
 <attr>PLACE.USER_DEF7</attr>
 <attr>PLACE.USER_DEF8</attr>
  </attrs>
  <where>
    <join_constraint>
      <constraint>
        <left_operand>PLACE.PHY_SVC_GRP_A</left_operand>
        <operator>EQUI</operator>
        <right_operand>PERSON.PHY_SVC_GRP_A</right_operand>
      </constraint>
    </join_constraint>
    <data_constraint>
      <constraint>
        <left_operand>PERSON.PERSON_ID</left_operand>
        <operator>EQ</operator>
        <right_operand>{PERSON_ID}</right_operand>
      </constraint>
    </data_constraint>
  </where>
</hierarchy_select>

Userlevel 4
Badge +7

Hi,

Please share the client script, so that we can give some insight.

/Sanjeewa

Reply