Help with script include returning an error to mobile app

gjz
Giga Sage

I created a function for catalog tasks in ITSM Mobile Agent.  The function works fine and separately the script include works fine, but one line in the script include causes an error in the mobile app and I can't figure out why.

 

I know my function in the mobile app is working because I have run it line by line to figure out where it is failing.  I also know my script in the script include is functioning because I ran it separately in backgrounds scripts and it ran without failure.

 

The script is simple, I'm just adding a row to a multi-row variable set on the requested item.

 

This is the code from the script include - it's failing on the code highlighted in orange:

    addReturnedAssets: function(recordSysId, assetId, assetDisposition) {
        gs.log('@@@ inputs: ' + recordSysId + ' / ' + assetId + ' / ' + assetDisposition);
        var taskId = recordSysId;
        var assetTag = assetId;
        var disposition = assetDisposition;
        var ritmID;

        // Get RITM sysid
        var sc = new GlideRecord('sc_task');
        sc.get(taskId);
        ritmID = sc.getValue('request_item');

        // Get RITM
        var ritm = new GlideRecord('sc_req_item');
        ritm.get(ritmID);

        var mrvs = ritm.variables.returned_assets;
        gs.log('@@@ mrvs: ' + mrvs);
        var newRow = mrvs.addRow();
        newRow.returned_asset_tag = assetTag;
        newRow.setCellValue('asset_disposition', disposition);
        gs.log('@@@ mrvs again: ' + mrvs);
        ritm.update();

    },
 
This is the script log:
gjz_0-1795545717543.png

 

Can anyone tell my why the script works in the core UI but not from a mobile writeback action?  Again, I know the writeback function works because it runs the script include and I have input data in the logs.

 

This is the writeback action:

gjz_1-1795545898991.png

 

 

0 REPLIES 0