How to get user's browser and operating system from record producer

ritaaudi
Tera Contributor

Hi: In a record producer for incident, I need to record the user's browser and operating system. Can I look that up in the business rule? Any idea how? Thank you!

12 REPLIES 12

TrevorK
Kilo Sage

I wonder if you would be better off grabbing the browser type and version through Javascript (via Client Script).



However, that said, the following will give you the browser version and type through a Business Rule as you asked:


gs.log("Browser " + gs.getSession().getProperty('user_agent_browser'));

  gs.log("Version " + gs.getSession().getProperty('user_agent_version'));


ritaaudi
Tera Contributor

Hi: Unfortunately that didn't work. Can you please advise on the client script code? Thank you!


You can use the navigator. in your client script:


Tryit Editor v3.5


This example shows you some of the attributes you can access.



I have tested this in a client script and it works fine.


Harsh Vardhan
Giga Patron

Hi Rita,



you need to create script include and call it that function in catalog client script through glide ajax.


i tested it and it is working on record producer.



Please find the script below.



Catalog Client Script:



function onLoad() {


    //Type appropriate comment here, and begin script below


    var check = new GlideAjax('global.details');


check.addParam('sysparm_name', 'bdetails');


check.getXML(analyzeResponse);


function analyzeResponse(response)


{


var answer = response.responseXML.documentElement.getAttribute("answer");


alert(answer);


g_form.setValue('details',answer); // i set the details in one of the variable on record producer.


}


}



Script Include:




var details = Class.create();


details.prototype = Object.extendsObject(AbstractAjaxProcessor, {



bdetails: function()


{


var checkbrowser=gs.getSession().getProperty('user_agent_browser');


var checkversion=gs.getSession().getProperty('user_agent_version');


var details=checkbrowser+' '+checkversion;



gs.log('will it work:'+details);



return details;


},



type: 'details'


});



I tested and it is working



catalog cs.png



script include.png



Final Output


rp v details.png



Please check the thread below.


Capture browser and basic OS information



Thanks,


Harshvardhan