Mobile UI Rule client script for calling script include not working properly

Rami_Joulani
Tera Contributor

I am trying to call my mobile callable script include with this script:

 

function onChange(inputName, newValue) {
    if (newValue == "") {
        return;
    }
    var assetTag = m_form.getValue("Asset tag");

    var caller = new MobileScriptIncludeCaller("AssetLogger", "logAsset");
    m_form.addInfoMessage("Asset: " + assetTag);
    caller.addParam("asset_tag", assetTag);
    caller.call(function(response) {
        m_form.addInfoMessage("Done! Response: " + response);

    });
}

Now I get the info message printed so it works, but nothing happens after, I have gs.log on the script include I don't see it run in the system log, so it's not called at all, also the Done! doesn't run

what could be the issue?
this is exactly like the docs.
they are on the same scope, mobile callable, names are correct, can't really tell.

2 REPLIES 2

camiloza
Tera Contributor

Hello there!

I just read this today, as I was also looking for this Client Script Syntax myself. 

Is hard to know from that perspective as I don't know the characteristics of your Script Include. My first suggestion is to double check if you are not adding an unnecessary value to the UI Rule Action. For instance something like the "Reverse if False" option that shouldn't be populated. You can check here, what you shouldn't use on to UI Rules to auto fill fields. Configure auto-fill inputs on input form screens

Now for what you mention, that the Mwssage actually was printed (which I'm guessing is the first one wit the Asset Tag) I would say maybe try adding a "error" function to the caller.call function. 

I have to thank you as I was looking for the documentation on the MobileScriptIncludeCaller, and there you can have a second parameter function define for error situations. Since you are printing something initially, means your Client Script is ok and is accessing, but if the logs are not working to print what you have in the Script Include, perhaps is best to check first if the call to the Script Include is the problem. 

Something like

caller.call(
    function successCallback(response) {
        // Handle success
       m_form.addInfoMessage("Done! Response: " + response);
    },
    function errorCallback(error) {
        // Handle error
        m_form.addInfoMessage("Error: " + error);
    }
);


This is just to debug if the problem is on the call, but let me know if you managed to resolve the issue. 

Jean-Emmanuel 1
Tera Contributor

Hello @Rami_Joulani ,
The issue seems related to gs.log which is not supported in Scope app.