GlideMobileExtensions.getDeviceType() intermittently does not show device type

pennieturner
Mega Guru

We are using the following code in a business rule:

GlideMobileExtensions.getDeviceType()

It shows what device type is being used, and in our BR we are setting a delivery address to be the 'requested for' if a mobile is used.

We have seen that intermittently the device type is not captured, therefore when someone on a mobile does orders something, its not setting it as 'm' therefore our code doesn't run to set the delivery address.

Has anyone come across this before?   Any advice to get it so it sets it all the time?

5 REPLIES 5

Ashley
Kilo Sage

Hi Pennie,



I'm trying to use GlideMobileExtensions.getDeviceType() in a Business Rule to return the Device being used but not having much luck with it.



Not as straight forward as: var device = GlideMobileExtensions.getDeviceType();....?



Ashley


Hi



This is what I did:



var deviceType = GlideMobileExtensions.getDeviceType();



It either comes out as 'm' for mobile or 'doctype' for desktop.   Sometimes it comes out blank even though the mobile has been used.



Are you getting nothing every time? Can you test on another mobile/desktop?


Yeah that is what I am trying but it's currently not doing anything .... in a Business Rule on a Record Producer



Run on Display


Table: Record Producer {sc_cat_item_producer}


No Condition (So it runs everytime)



Script:


(function executeRule(current, previous /*null when async*/) {



var deviceType = GlideMobileExtensions.getDeviceType();


if (deviceType == "doctype") {


            //current.approval_source = "ui.mobile";


            g_form.setDisplay('user_company', false);


            g_form.setDisplay('user_location', false);


  }


})(current, previous);


Hi



From what that script looks like your trying to capture the device type on the actual item, before its been submitted? MMhhh not sure you will be able to...you may need to convert the script to a catalog client script and see if you can get it working from there? might mean a slightly different command than 'GlideMobileExtensions.getDeviceType();' but you could try it?