The CreatorCon Call for Content is officially open! Get started here.

HOw to display incident on map location

wakespirit
Kilo Guru

Dear all,

I need to build on ServiceNow mobile a page in which I have :

A list of Incident which has the GPS position in which it has been identified
When user select an Incident, I need to display it on google maps as part of my Incident view ( I do not want to display a new page)

Any idea how to approach this ?

regards

9 REPLIES 9

There is a field added to sys_user table when we activate Geoloaction plugin, named - Geolocation tracking which will be unchecked(false) by default. Hence to make this as true for your user profiles(here bus drivers), you must write a script to run in background to make the checkbox true, something like one time run action.

var gr = new GlideRecord('sys_user');
gr.addQuery('busdriver common field','common value') //here add your bus driver unique matching field to collect all users
gr.query();
while (gr.next()){
 gr.geolocation_tracked = true;
 gr.update();
}
gs.log(gr.getRowCount()); //helps in seeing how many records got updated

The above code must be run in background-script module after you enable security_admin elevated role. Hope you get some idea on this.

Regards, Akash

Regards, Akash
If my response proves useful, please mark it "Accept as Solution" and "Helpful". This action benefits both the community and me.

What is the difference by doing that way instead of adding a new string field in Incident form and add the attribute current_location ?

By doing so I get a new field in my bobile fomr where I can request GPS automatically and gets updated in the field as below

find_real_file.png

 

Good going actually, but for this process we need to request Google API for GPS all the time from our custom script, while these tracking are made easy by ServiceNow pluign, so I suggested that way. I didn't check on the plugin payment type but if that's free I would encourage you to go plugin way.

Yet, you can proceed any of these ways. But scripting must be taken care at particular interval of time for which you cannot use Google Map Properties available within the plugin.

Regards, Akash

Regards, Akash
If my response proves useful, please mark it "Accept as Solution" and "Helpful". This action benefits both the community and me.

U have try to activate the Geolocation plug in my sN dev instance but it fails to activate, any idea?

Hello wackesprit,

I fell in the same case as you; it would be worth displaying an incident a card  map in app now mobile , can you give me an idea thank you very much

kader