[2ff88f42] feat(connector-superoffice): Implement Sale and Project entities, refine workflow
This commit extends the SuperOffice connector to support the creation and linking of Sale \(Opportunity\) and Project \(Campaign\) entities, providing a comprehensive foundation for both sales and marketing automation workflows.
Key achievements:
- **`SUPEROFFICE_INTEGRATION_PLAN.md`**: Updated to include strategic mapping of D365 concepts \(Opportunity, Campaign\) to SuperOffice entities \(Sale, Project\).
- **`connector-superoffice/superoffice_client.py`**:
- Implemented `create_sale` method to generate new opportunities, correctly mapping `Title` to SuperOffices
This commit is contained in:
@@ -33,7 +33,7 @@ def main():
|
||||
logger.info("Step 1: Testing connection...")
|
||||
user_info = client.test_connection()
|
||||
if user_info:
|
||||
logger.info(f"Connected successfully as: {user_info.get('Name')}")
|
||||
logger.info(f"Connected successfully as: {user_info.get('FullName')}")
|
||||
else:
|
||||
logger.error("Connection test failed.")
|
||||
return
|
||||
@@ -76,9 +76,40 @@ def main():
|
||||
|
||||
if person:
|
||||
logger.info("SUCCESS: Person created!")
|
||||
person_id = person.get('PersonId')
|
||||
logger.info(f"Name: {person.get('Firstname')} {person.get('Lastname')}")
|
||||
logger.info(f"Person ID: {person.get('PersonId')}")
|
||||
logger.info(f"Person ID: {person_id}")
|
||||
logger.info(f"Linked to Contact ID: {person.get('Contact').get('ContactId')}")
|
||||
|
||||
# 4. Create a Sale for this company
|
||||
logger.info(f"Step 4: Creating Sale for Contact ID {target_contact_id}...")
|
||||
sale = client.create_sale(
|
||||
title=f"Robotics Automation Opportunity - {demo_company_name}",
|
||||
contact_id=target_contact_id,
|
||||
person_id=person_id,
|
||||
amount=50000.0
|
||||
)
|
||||
if sale:
|
||||
logger.info("SUCCESS: Sale created!")
|
||||
logger.info(f"Sale Title: {sale.get('Heading')}")
|
||||
logger.info(f"Sale ID: {sale.get('SaleId')}")
|
||||
else:
|
||||
logger.error("Failed to create sale.")
|
||||
|
||||
# 5. Create a Project for this company and add the person to it
|
||||
logger.info(f"Step 5: Creating Project for Contact ID {target_contact_id} and adding Person ID {person_id}...")
|
||||
project = client.create_project(
|
||||
name=f"Marketing Campaign Q1 [2ff88f42]",
|
||||
contact_id=target_contact_id,
|
||||
person_id=person_id
|
||||
)
|
||||
if project:
|
||||
logger.info("SUCCESS: Project created and person added!")
|
||||
logger.info(f"Project Name: {project.get('Name')}")
|
||||
logger.info(f"Project ID: {project.get('ProjectId')}")
|
||||
else:
|
||||
logger.error("Failed to create project.")
|
||||
|
||||
else:
|
||||
logger.error("Failed to create person.")
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user