Publish Appointments to Dynamics 365
publish_appointments_to_dataverseMicrosoft Copilot (Entra sign-in): writes Dynamics 365 Appointments onto reps' calendars, one per account in a route or dated schedule; Outlook syncs from Dynamics. Takes map_session_id or ts_handle and one source. route_ids (calculate_route): start = departure + drive time + earlier onsite time (time_basis=routed); route_departures supplies a missing depart_at. visit_layer (schedule_visits with calendar dates): stacks each rep's day from day_start_time (time_basis=approximate). Appointments cover onsite time; drive time goes in the description. Visits without saved onsite time require default_duration_minutes (no default; returns needs_appointment_duration). organizer_map maps a route or rep to a Dynamics user, else default_organizer, else the signed-in user. confirm=false (default) previews (confirmation_required, organizers, counts, preview_appointments, ask_user); confirm=true queues the write. Repeat publishes update earlier open appointments. Account columns use publish_to_dataverse.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "publish_appointments_to_dataverse"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| confirm | No | False (default) runs the read-only preflight. True queues the write after the user confirms the count, the calendars, and the times. | |
| timezone | No | IANA time zone of the visits (e.g. America/New_York). Required for visit_layer and for a route departure that carries no UTC offset. No default. | |
| rep_field | No | visit_layer only: visit column naming the rep. Default contractor_label. | |
| route_ids | No | calculate_route route_id values to publish (exact clock times). Exclusive with visit_layer. | |
| ts_handle | No | Territory Solution reference (tsh_...) from a build, ingest_accounts, import_geojson, import_designer_project, or get_map_visualization; Territory Solutions are not accepted inline. | |
| gap_minutes | No | visit_layer only: minutes left between stacked visits. Default 0. | |
| visit_layer | No | schedule_visits visit layer (e.g. accounts_visits) to publish with approximate times. Needs schedule dates, timezone, and day_start_time. Exclusive with route_ids. | |
| organizer_map | No | Route label, route_id, or rep name -> Dynamics user (full name, email, or systemuserid). That user owns and organizes the appointments. | |
| day_start_time | No | visit_layer only: local time each rep's day starts, HH:MM 24-hour. No default. | |
| map_session_id | No | Open map session (msess_...) from get_map_visualization. Its Territory Solution is the input; omit ts_handle when set. | |
| subject_prefix | No | Subject is '<prefix>: <account name>'. Default 'Visit'. | |
| environment_url | No | Dynamics 365 environment (e.g. https://contoso.crm.dynamics.com). Defaults to the environment the accounts were imported from, or the user's sole environment. | |
| route_departures | No | route_id -> local start date-time (YYYY-MM-DDTHH:MM) for a route with no depart_at, or to move a route to another day. | |
| default_organizer | No | Dynamics user for visits with no rep. Defaults to the signed-in user. | |
| default_duration_minutes | No | Minutes for any stop with no saved onsite (dwell) time; sets appointment length and spacing before the next stop. No default (required when any visit lacks dwell_minutes). default_duration_used_count reports how many used it. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | ||
| error | No | Present when ok is false. | |
| result | No | Present when ok is true. A submission returns the task reference (task_id, next_action, sleep_ms); the completed task result carries the remaining fields. | |
| warnings | No |