none
Set Geolocation field value in SPD workflow

    Question

  • Hi,

    How can I set the new geolocation field in a SP2013 list from a SPD list workflow?  I've tried 'Set Location to Point([%Variable: X%] [%Variable: Y%])' hoping that a string would work but this fails.

    Thanks in advance

    Monday, April 08, 2013 12:04 AM

All replies

  • Hi,

    I understand that you want to set the field value using workflow. Are you using SharePoint 2013 workflow or SharePoint 2010 workflow? What error message do you get when running the workflow?

    Assume that the geolocation field is a text box field and you want to set the field to get value of variable X and variable Y. If so, the workflow should work. You can have a test with a SharePoint 2010 workflow with the same action to see whether it works.

    If I have any misunderstanding, please feel free to let me know.

    Thanks,

    Entan Ming


    Entan Ming
    TechNet Community Support

    Monday, April 08, 2013 9:03 AM
    Moderator
  • Hi,

    I'm using a SPD 2013 list workflow.  The field to be set is the new Geolocation field in 2013 (see http://msdn.microsoft.com/en-us/library/jj164050.aspx ).  My reference to the variable X and Y was an attempt to construct a string to populate the Geolocation field using the 'raw value' method B described in the web page.  I would not be able to test with 2010 as it does not have the Geolocation field.

    The workflow gets suspended with the following error message;

    RequestorId: 91adda23-7a37-d55f-0000-000000000000. Details: An unhandled exception occurred during the execution of the workflow instance. Exception details: System.ApplicationException: HTTP 400 {"Transfer-Encoding":["chunked"],"X-SharePointHealthScore":["0"],"SPClientServiceRequestDuration":["39"],"SPRequestGuid":["91adda23-7a37-d55f-b0ce-7a87af2020c9"],"request-id":["91adda23-7a37-d55f-b0ce-7a87af2020c9"],"X-FRAME-OPTIONS":["SAMEORIGIN"],"MicrosoftSharePointTeamServices":["15.0.0.4454"],"X-Content-Type-Options":["nosniff"],"X-MS-InvokeApp":["1; RequireReadOnly"],"Cache-Control":["max-age=0, private"],"Date":["Mon, 08 Apr 2013 04:16:46 GMT"],"P3P":["CP=\"ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI\""],"Server":["Microsoft-IIS\/7.5"],"X-AspNet-Version":["4.0.30319"],"X-Powered-By":["ASP.NET"]} at Microsoft.Activities.Hosting.Runtime.Subroutine.SubroutineChild.Execute(CodeActivityContext context) in d:\bt\103818\private\source\WF\Microsoft.Activities.Hosting\Microsoft\Activities\Hosting\Runtime\Subroutine.cs:line 282 at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

    Monday, April 08, 2013 9:47 AM
  • Geolocation is ace functionality in SP2013 but not being able to import Lat/Long data directly or through a workflow lets it down.  I believe you can use a Call to REST services but I've not been able to make it work.
    Saturday, November 09, 2013 4:20 PM
  • I, too would appreciate an answer to this.  Not being able to easily update the geolocation field in a SharePoint Workflow seriously limits the usability of this feature.

    This fellow, Borislav, an MVP, posted how to lookup locations through Bing, and then update the geolocation field using the "Call Http Service" function, however his method actually doesn't work, and doesn't apply to the original question about Lists where you ALREADY have latitude and longitude.

    http://mysharepointinsight.blogspot.com/2013/05/how-to-get-coordinates-for-geolocation.html

    Seems like the key is the "Call Http Service," but I have not yet seen a good example of how to implement it.

    Does anyone have a solution for the original poster and my question as well - - how to update the geolocation field using SharePoint Designer 2013 and pulling existing latitude and longitude from the list?

    A solution would be greatly appreciated!

    -James

    Friday, November 15, 2013 8:36 PM
  • Did you ever get an answer to this? It looks like the last comment on the thread was a few months ago. I'm also looking to update a geolocation column via a workflow and have not been able to figure out any way to write to that field type from a workflow.
    Wednesday, October 08, 2014 5:00 PM
  • Did you ever get an answer to this? It looks like the last comment on the thread was a few months ago. I'm also looking to update a geolocation column via a workflow and have not been able to figure out any way to write to that field type from a workflow.

    The correct construction for a string variable to set a Geo Location data column is:

    POINT (LONGITUDE LATITUDE)

    If your taking your latitude and longitude values from a calculated column in the workflow, be sure you extract a substring from index (starting at 8) or your values will include 'float;#'.

    Friday, October 10, 2014 9:19 PM
  • Has anyone found a solution to this issue?  The ability to use a workflow to set the Geolocation field would be a great solution.  I attempted to use the solution James suggested but it does not work.   I don't quite understand:

     

    POINT (LONGITUDE LATITUDE)

    If your taking your latitude and longitude values from a calculated column in the workflow, be sure you extract a substring from index (starting at 8) or your values will include 'float;#'.

    Are you saying that need to use his blog and change the long and lat variables in the dictionary to Point and build a string variable instead?

    Or can I just submit a string variable to the Geolocation with both the longitude and Latitude?

    Tuesday, December 30, 2014 3:45 PM
  • Hi,

    Did anyone ever find a solution for this? I'm going to try to bypass this by using the "Call http webservice",
    but it would be much nicer if we just could use the Point (x y) command.

    Wednesday, February 18, 2015 9:00 AM
  • Yes, this works fine using a SP 2010 Workflow.

    If you have a lat and long field that you have calculated on your list you can use a workflow to set the location field.  As a previous poster said, the key is to extract a substring from the existing fields because even though they may be text, sharepoint will append float;# to the front of the value.

    1. First in the workflow, your action should be "Extract Substring from Index of String".  Set it to copy from your calculated Lat or Long field, starting at 8 and output to a variable (VarLong / VarLat is what I named mine).
    2. Repeat this for your other value.
    3. Set your Location field to be POINT (VarLong VarLat)

    Example from one of my workflows:

    Copy from [%Current Item:Longitude%] , starting at 8 (Output to Variable: VarLong )

    Copy from [%Current Item:Latitude%] , starting at 8 (Output to Variable: VarLat )

    Set Location to POINT ([%Variable: VarLong%] [%Variable:VarLat%)

    Wednesday, April 22, 2015 4:49 PM
  • Hi Can you explain how to achieved this using call webservice action?
    Friday, February 09, 2018 7:14 PM
  • Hi,

    were you able to run this workflow success fully I tried the same for sharepoint online I received below error while executing workflow:

    An unexpected 'PrimitiveValue' node was found when reading from the JSON reader. A 'StartObject' node was expected

    Friday, February 09, 2018 7:15 PM