2

This is more of a general question on design approach rather than a specific programming challenge. We have a business need to schedule resources, but to reduce travel costs we need to be able to schedule resources for a customer's appointment that are geographically close. These appointments are typically in the customer's home and not at a designated site.

The process for doing the geolocation is to take the customer's location and chosen service activty, find all resources that have availability during that time frame and then rank them in order of proximity based on their previous appointment location.

That is all well and good, but the problem I have is where do I insert this logic? Would it be during the "Book" message on the Service Appointment entity through a plugin? How would this appear to the end user? Do I have to simiulate the Service Calendar functionality in a custom aspx page to accomplish this instead?

Is there a better way of doing this?

Novus
  • 197
  • 2
  • 15

1 Answers1

0

You can do this via JavaScript...

1) Create the service rep relationship to the service appointment entity. Add the service rep lookup to the service appointment entity.

2) Create a dummy text attribute and add to service appointment form

3) Fetch all of the records meeting the availability criteria you have and use either a 3rd party mapping service or based on the lng/lat distance to determine who is closest.

FetchXML - GeoCode Distance search by distance

4) Switch your dummy textbox to a select and add the options of the 10 closest service reps with their name and distance (ie. Paul Way - 1.2 miles)

5) When the new select box value is changed, populate the rep attribute on the form.

6) After testing, hide the rep attribute via javascript so that it will save the change but the user is forced to use the custom select box.

Community
  • 1
  • 1
Paul Way
  • 1,966
  • 1
  • 13
  • 10