cancel
Showing results for 
Search instead for 
Did you mean: 

Agentry Fetch GPS Location using javascript

Former Member
0 Kudos

Hi All,

I am want to fetch current latitude and longitude using GPS. Can i add the javascript in side the rule and map it to a button. I want to capture the lat long values and update it to the back end CRM. Please tell me how to acheive this.

Thanks,

Divya

Accepted Solutions (0)

Answers (1)

Answers (1)

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

Divya,

I don't think you need to use javascript to accomplish this.  Agentry provides native rule terms for retrieving the GPS_LOCATION and in turn getting the LATITUDE and LONGITUDE.  This of course assumes the device has GPS hardware. 

In terms of updating the backend, you can create an action (executed from a button) that runs a transaction to capture the current lat, long that will then update the backend using the Transaction update steps.

--Bill

Former Member
0 Kudos

Hi Bill,

Thanks for the reply. I had posted this thread for accessing device current location.

scn.sap.com/message/15779664#15779664

I referred this thread for doing this.

scn.sap.com/thread/3593013

I did the same steps mentioned in the above thread. But When i run the SAPCRMSM App, and click the "Map" button, i get an error

"The transaction validation failed.  Cannot back into an Action Step %1".

Please help in resolving this error.

Thanks,

Divya

Former Member
0 Kudos

Create a Message Step and pop up the value you get from GPS_Location, make sure you get the current value.

former_member208808
Active Participant
0 Kudos

Hi Divya,

Refer following steps to get current Latitude and Longitude and send it to backend

1)Create a property of type Location in object that you are sending to backend.

2)Create a transaction for this object Edit/Add according to your requirements.

   (Here location is of type Location and refer to Location property from Flight object)

3)For this Location property in transaction add Rule-Before Data entry/rule after data entry according to your requirement.(I have added Rule before data entry)

That rule will look like below....

4) Refer/add this property on screen for that transaction (optional depending upon your requirement).


5) Create an action which will initiate this transaction.Action steps as below

   

6) Create a java steplet class (and further stephandler and bapi).And access this property as shown below.

(Its up to you where you want to access these properties.I have accessed them in steplet itself.You can access them in bapi setParameters() method or anywhere appropriate.)

7)If all steps configured correctly it will work as shown below

Enabling GPS

Add New Flight

Will look like this on Screen

😎 When you will transmit it.It printed as below on my console

Latitude is :51.507351

Longitude is :-0.1277

Hope this helps.....

Regards,

AK

Former Member
0 Kudos

Hi AK K,

Thanks for the response. I tried the same in Agentry Client and in IPAD. In IPAD i enabled the Location Services.

I created a property called as "ZLocation" of type "Location".

ZLocation Rule - i created with GPS_Location.

I tried printing the values of "transaction.ZLocation.Latitude" and "transaction.ZLocation.Longitude". But both is returning null.

I tried in IPAD. But output is "null". I am working on CRMSM 4.1 with Agentry Client -

Can i test (CRMSM 4.1) GPS feature on this version of Agentry Client?    What other configuration i am missing?

Please do help me in resolving this issue.

Thanks,

Divya

former_member208808
Active Participant
0 Kudos

Hi Divya,

from screensnap for "Agentry Client" i think you are using WPF client.

So this may not be possible to test because you can not simulate GPS for this.

Instead you can use "Agentry ATE Client" for this where you can have GPS simulation enabled for this.

ATE Client whith GPS simulation enabled:

Or other option is to try with device which has GPS hardware in it...

Regards,

AK

Former Member
0 Kudos

If you are using iOS 8 on your iPad, there is currently an known issue where the location isn't working.

Former Member
0 Kudos

Hi AK K,

How Can i bring it on ATE. I tried deploying my SAPCRMSM 4.1 Application on ATE. Only Calendar Screen is coming. I am not able to go to the service order item screen.  Is it Compatibility Issue. I am using SMP Server 3.0 SP 04.

Which Version of ATE will be compatible with CRMSM4.1.

Thanks,

Divya

former_member208808
Active Participant
0 Kudos

Hi Divya,

Yes i think its known issue that ATE do not render ipad screens properly,

We also tried to view Workorder screens for ipad on ATE and its not rendering them correctly.

But still you can try this on device with GPS support for testing..

Regards,

AK

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

Divya,

Please download and install the latest SMP3 SDK (SP07 PL01 at the time of this post) and install the updated Agentry Editor component.  The Editor now includes a built in Agentry Test Environment to replace the standalone version.  It is based on the WPF client and does a much better job at handling the iPad screens and newer controls.

The ATE in the Editor can view objects, CT/DT, transactions.  Debug Actions, Rules, Transactions just like the standalone version.

--Bill

Former Member
0 Kudos

Hi Stephen,

The IPAD OS Version is 7. But still location details it is not showing. What else could be the error.

Agentry Fetch GPS Location

I have followed the document "Agentry Fetch Device Location". Then i get the error - "Transaction Validation Failed. If i try to print the values as said above - "Value is null".

Mean while I will also try to download this SDK ( SMP3 SDK (SP07 PL01)).

Please do help to get the location details in my IPAD.

Thanks,

Divya

Former Member
0 Kudos

Hi Bill,

As you said, I have installed SMP3 SDK (SP07 PL01). Now i can debug my objects and Transactions. Here how do i pass latitude and longitude values. i mean enable GPS simulation.

In debug it calls ResetGPS and QueryGPS Transaction. But everything is 0. I cannot see any values.

Please do help.

Thanks,

Divya