Activities Sub Service - Nioron07/Easy-Acumatica GitHub Wiki
This guide covers the ActivitiesService
, which is used to create activities (like notes, tasks, or events) and link them to other records in Acumatica, such as Cases, Customers, or Leads.
1. Accessing the Service
The ActivitiesService
must be added to your AcumaticaClient
and is then available as an attribute.
AcumaticaClient
Assuming 'client' is an initialized activities_service = client.activities
2. The Linking Process
To link an activity to another record, you first need the NoteID
(a GUID) of that specific record. You can get this NoteID
when you create the record or by fetching it from Acumatica.
3. Creating an Activity Linked to a Customer
create_activity_linked_to_customer(api_version, customer_note_id, summary, details, activity_type="M")
This method creates a new activity and attaches it to a customer.
Example:
customer_note_id = "f37200d6-35ea-eb11-9dee-9828a61840c3" # Example NoteID
try:
new_activity = client.activities.create_activity_linked_to_customer(
api_version="24.200.001",
customer_note_id=customer_note_id,
summary="Follow-up call with customer",
details="Discussed the new pricing model and upcoming features."
)
print("Activity created and linked to customer successfully.")
except Exception as e:
print(f"Failed to create activity: {e}")
4. Creating an Activity Linked to a Case
create_activity_linked_to_case(api_version, case_note_id, summary, details, activity_type="M")
This method links an activity to a support case.
Example:
case_note_id = "e3f46a39-1a14-e911-816f-bc920a5e0ac8" # Example NoteID
try:
new_task = client.activities.create_activity_linked_to_case(
api_version="24.200.001",
case_note_id=case_note_id,
summary="Investigate login issue",
details="User reports being unable to log in since the last update.",
activity_type="T" # 'T' for Task
)
print("Task created and linked to case successfully.")
except Exception as e:
print(f"Failed to create task: {e}")
5. Creating an Activity Linked to a Lead
create_activity_linked_to_lead(api_version, lead_note_id, summary, details, activity_type="M")
This method links an activity to a sales lead.
Example:
lead_note_id = "a1b2c3d4-e5f6-a7b8-c9d0-e1f2a3b4c5d6" # Example NoteID
try:
new_activity = client.activities.create_activity_linked_to_lead(
api_version="24.200.001",
lead_note_id=lead_note_id,
summary="Initial contact with new lead",
details="Sent introductory email and scheduled a demo for next week."
)
print("Activity created and linked to lead successfully.")
except Exception as e:
print(f"Failed to create activity: {e}")