Finalize SuperOffice production migration and multi-campaign architecture (v1.8)

This commit is contained in:
2026-02-27 15:09:52 +00:00
parent 9f9a09375e
commit 04c7c9fc6c
17 changed files with 443 additions and 311 deletions

View File

@@ -15,52 +15,32 @@ def discover():
return
# 1. Discover UDFs (User Defined Fields)
print("\n--- 1. User Defined Fields (UDFs) ---")
# Contact UDFs
print("\n--- 1. User Defined Fields (UDFs) Definitions ---")
try:
print("Fetching a sample Contact to inspect UDFs...")
contacts = client.search("Contact?$top=1")
if contacts:
# Inspect keys of first result
first_contact = contacts[0]
# Try to find ID
c_id = first_contact.get('ContactId') or first_contact.get('PrimaryKey')
# Fetch Metadata about UDFs to get Labels
udf_info = client._get("UserDefinedFieldInfo")
if udf_info:
print(f"Found {len(udf_info)} UDF definitions.")
if c_id:
c = client.get_contact(c_id)
udfs = c.get("UserDefinedFields", {})
print(f"Found {len(udfs)} UDFs on Contact {c_id}:")
for k, v in udfs.items():
print(f" - Key (ProgId): {k} | Value: {v}")
else:
print(f"⚠️ Could not find ID in search result: {first_contact.keys()}")
else:
print("⚠️ No contacts found. Cannot inspect Contact UDFs.")
print("\nFetching a sample Person to inspect UDFs...")
persons = client.search("Person?$top=1")
if persons:
first_person = persons[0]
p_id = first_person.get('PersonId') or first_person.get('PrimaryKey')
# Filter for Contact and Person UDFs
contact_udfs = [u for u in udf_info if u['UDTargetEntityName'] == 'Contact']
person_udfs = [u for u in udf_info if u['UDTargetEntityName'] == 'Person']
if p_id:
p = client.get_person(p_id)
udfs = p.get("UserDefinedFields", {})
print(f"Found {len(udfs)} UDFs on Person {p_id}:")
for k, v in udfs.items():
print(f" - Key (ProgId): {k} | Value: {v}")
else:
print(f"⚠️ Could not find ID in search result: {first_person.keys()}")
print(f"\n--- CONTACT UDFs ({len(contact_udfs)}) ---")
for u in contact_udfs:
print(f" - Label: '{u['FieldLabel']}' | ProgId: '{u['ProgId']}' | Type: {u['UDFieldType']}")
print(f"\n--- PERSON UDFs ({len(person_udfs)}) ---")
for u in person_udfs:
print(f" - Label: '{u['FieldLabel']}' | ProgId: '{u['ProgId']}' | Type: {u['UDFieldType']}")
else:
print("⚠️ No persons found. Cannot inspect Person UDFs.")
print("❌ Could not fetch UserDefinedFieldInfo.")
except Exception as e:
print(f"❌ Error inspecting UDFs: {e}")
print(f"❌ Error fetching UDF Info: {e}")
# 2. Discover Lists (MDO Providers)
print("\n--- 2. MDO Lists (Positions, Business/Industry) ---")
print("\n--- 2. Sample Data Inspection ---")
lists_to_check = ["position", "business"]