Opportunity

An Opportunity in Maximizer CRM is a way to track a potential sale or business deal that a given company is working on. It helps businesses organize inquiries that have shown interest in their products or services and may result in a sale.

Think of an Opportunity as a digital file or record that stores all the important details about a possible deal. It is always associated with an AbEntry (Company, Individual or Contact) and has relevant information like what the customers are interested in, how much the deal might be worth, and when they might make a decision.

See below some considerations for Opportunities:

  • Some fields are mandatory when creating an Opportunity:
    • AbEntryKey\

    • Objective\

  • Optionally, an Opportunity can follow a pre-defined Sales Process.

HowTo's

Change Stage

1. List all Sales Processes

// POST https://api.maximizer.com/octopus/Read
// Authorization: Bearer <token>
{
    "Opportunity": {
        "FieldOptions": {
            "SalesProcess/Setup": [
                {
                    "Key": 1,
                    "Description": 1
                }
            ]
        }
    }
}

2. List all Stages of a Sales Process

// POST https://api.maximizer.com/octopus/Read
// Authorization: Bearer <token>
{
    "Opportunity": {
        "FieldOptions": {
            "CurrentSalesStage/Setup": [
                {
                    "Key": 1,
                    "Description": 1,
                    "ProbabilityClose": 1
                }
            ]
        },
        "Data": {
            "SalesProcessSetup": {
                "Key": "U2FsZXNQcm9jZXNzCURFRkFVTFQJMA==" // key read from step 1
            }
        }
    }
}

3. Read Current Sales Stage (Instance) from Opportunity

// POST https://api.maximizer.com/octopus/Read
// Authorization: Bearer <token>
{
    "Opportunity": {
        "Scope": {
            "Fields": {
                "Key": 1,
                "Objective": 1,
                "Status": 1,
                "SalesProcess": {
                    "Key": 1,
                    "Setup": 1,
                    "Description": 1,
                    "DisplayValue": 1
                },
                "CurrentSalesStage": {
                    "Key": 1,
                    "Setup": 1,
                    "Description": 1,
                    "Age": 1,
                    "TargetAge": 1,
                    "ProbabilityClose": 1,
                    "DisplayValue": 1
                }
            }
        },
        "Criteria": {
            "SearchQuery": {
                "Key": {
                    "$EQ": "T3Bwb3J0dW5pdHkJMjUwMTAzMjUxNTUwMzE0NTIwMDExTwkw"
                }
            }
        }
    }
}

4. Change Opportunity Stage

// POST https://api.maximizer.com/octopus/Update
// Authorization: Bearer <token>
{
    "Opportunity": {
        "Data": {
            "Key": "T3Bwb3J0dW5pdHkJMjUwMTAzMjUxNTUwMzE0NTIwMDExTwkw",
            "SalesStageSetupKey": "U2FsZXNQcm9jZXNzU3RhZ2VTZXR1cAkyMjA0MDYyNTEzNTE0Mjc0ODAwMDJHCTA=" // one of the keys read on step 2, depending to which stage you want to move the Opportunity to
        }
    }
}

Read - Opportunity by SalesProcessSetup

Use the AbEntryRead method to search for Address Book entries in the database.

// POST https://api.maximizer.com/octopus/Read
// Authorization: Bearer <token>
{
    "Opportunity": {
        "Scope": {
            "Fields": {
                "Key": 1,
                "Objective": 1,
                "SalesProcessSetup": {
                    "Key": 1,
                    "DisplayValue": 1
                }
            }
        },
        "Criteria": {
            "sSearchQuery": {
                "SalesProcessSetupKey": {
                    "$EQ": "U2FsZXNQcm9jZXNzCURFRkFVTFQJMA=="
                }
            },
            "Top": 3
        }
    }
}

Read - Opportunity Revenue by AbEntryKey or ContactKey

Use the AbEntryRead method to search for Address Book entries in the database.

// POST https://api.maximizer.com/octopus/Read
// Authorization: Bearer <token>
{
    "Opportunity": {
        "Scope": {
            "Fields": {
                "Key": 1,
                "Objective": 1,
                "ForecastRevenue": 1,
                "Revenue": 1,
                "Status": 1
            }
        },
        "Criteria": {
            "SearchQuery": {
                "$AND": [
                    {
                        "$OR": [
                            {
                                "AbEntryKey": {
                                    "$EQ": "Q29tcGFueQkyMjA1MDUyNTE1MzY1OTg0NTAwMDVDCTA="
                                }
                            },
                            {
                                "ContactKey": {
                                    "$EQ": "Q29tcGFueQkyMjA1MDUyNTE1MzY1OTg0NTAwMDVDCTA="
                                }
                            }
                        ]
                    },
                    {
                        "Status": {
                            "$IN": [
                                0,
                                2,
                                3
                            ]
                        }
                    }
                ]
            }
        }
    },
    // Required for retrieving Revenue property
    "Configuration": {
        "Drivers": {
            "IOpportunitySearcher": "Maximizer.Model.Access.Sql.OpportunitySearcher"
        }
    }
}

Read - Opportunity using $PHRASE operator

Use the AbEntryRead method to search for Address Book entries in the database.

// POST https://api.maximizer.com/octopus/Read
// Authorization: Bearer <token>
{
    "Opportunity": {
        "Scope": {
            "Fields": {
                "Key": 1,
                "Objective": 1,
                "Description": 1
            }
        },
        "Criteria": {
            "SearchQuery": {
                // This search will execute on the Objective & Description property
                "$PHRASE": "Test"
            },
            "Top": 3
        }
    }
}

Read - Opportunities created from Leads

Use the AbEntryRead method to search for Address Book entries in the database.

// POST https://api.maximizer.com/octopus/Read
// Authorization: Bearer <token>
{
    "Opportunity": {
        "Scope": {
            "Fields": {
                "Key": 1,
                "Objective": 1
            }
        },
        "Criteria": {
            "SearchQuery": {
                "Key": {
                    // This condition translates to: "retrieve all Lead objects that have OpportunityKey associated"
                    "$EXISTS(LeadObject)": "OpportunityKey"
                }
            },
            "Top": 3
        }
    },
    "Configuration": { // Needed for using $EXISTS
        "Drivers": {
            "IOpportunitySearcher": "Maximizer.Model.Access.Sql.OpportunitySearcher"
        }
    }
}

Read - Get monthly total revenue for a year

Use the AbEntryRead method to search for Address Book entries in the database.

// POST https://api.maximizer.com/octopus/Read
// Authorization: Bearer <token>
{
    "Opportunity": {
        "Scope": {
            "Fields": {
                "$MONTH(closeDate)": 1,
                "$COUNT()": 1,
                "$SUM(corporateRevenue)/displayValue": 1
            }
        },
        "Criteria": {
            "SearchQuery": {
                "$YEAR(CloseDate)": {
                    "$EQ": 2022
                }
            }
        },
        "GroupBy": {
            "Fields": [
                "$MONTH(CloseDate)"
            ]
        },
        "OrderBy": {
            "Fields": [
                {
                    "$MONTH(CloseDate)": "ASC"
                }
            ]
        }
    },
    // Needed for using $YEAR and $MONTH
    "Configuration": {
        "Drivers": {
            "IOpportunitySearcher": "Maximizer.Model.Access.Sql.OpportunitySearcher"
        }
    }
}

Read - Opportunity by PartnerInfo

Use the AbEntryRead method to search for Address Book entries in the database.

// POST https://api.maximizer.com/octopus/Read
// Authorization: Bearer <token>
{
    "Opportunity": {
        "Scope": {
            "Fields": {
                "Key": 1,
                "Objective": 1,
                "PartnerInfo": 1
            }
        },
        "Criteria": {
            "SearchQuery": {
                "PartnerInfo": {
                    "$EQ": {
                        "Key": "Q29udGFjdAlERU1PXzVDCTE="
                    }
                }
            },
            "Top": 3
        }
    },
    "Compatibility": {
        "AbEntryKey": "2.0"
    }
}

Read - Opportunity by SalesTeam

Use the AbEntryRead method to search for Address Book entries in the database.

// POST https://api.maximizer.com/octopus/Read
// Authorization: Bearer <token>
{
    "Opportunity": {
        "Scope": {
            "Fields": {
                "Key": 1,
                "Objective": 1,
                "SalesTeam": 1
            }
        },
        "Criteria": {
            "SearchQuery": {
                "SalesTeam/Key": {
                    "$EQ": "U2FsZXNUZWFtCTE="
                }
            },
            "Top": 3
        }
    }
}

Read - Sales stages of a given opportunity

Use the AbEntryRead method to search for Address Book entries in the database.

// POST https://api.maximizer.com/octopus/Read
// Authorization: Bearer <token>
{
    "SalesStage": {
        "Scope": {
            "Fields": {
                "Key": 1,
                "Description": 1,
                "ProbabilityClose": 1,
                "Age": {
                    "DisplayValue": 1
                },
                "Current": 1
            }
        },
        "Criteria": {
            "SearchQuery": {
                "OpportunityKey": {
                    "$EQ": "T3Bwb3J0dW5pdHkJMjIwNTA1MjUxNTM2NTg5NDAwMDAzTwkw"
                }
            }
        }
    }
}

Update - Change AbEntryKey of an existing opportunity

// POST https://api.maximizer.com/octopus/Update
// Authorization: Bearer <token>
{
    "Opportunity": {
        "Data": {
            "Key": "T3Bwb3J0dW5pdHkJMjQwMTA4MjUxNDM2MjgzNzcwMDAxTwkw", // Mandatory
            "AbEntryKey": "QWJFbnRyeQkyMjA1MDUyNTE1MzY1OTg0NTAwMDVDCTA="
        }
    },
    "Configuration": {
        "Drivers": {
            // Changing AbEntryKey of an Opportunity is supported by SQL Driver only
            "IOpportunityAccess": "Maximizer.Model.Access.Sql.OpportunityAccess"
        }
    }
}

Metadata

Read Opportunity metadata (simple)

Use the SchemaRead method to query the structure or metadata of entities in the database.

// POST https://api.maximizer.com/octopus/Read
// Authorization: Bearer <token>
{
    "Schema": {
        "Scope": {
            "Fields": 1
        },
        "Criteria": {
            "SearchQuery": {
                "Key": {
                    "$TREE": "/Opportunity"
                }
            }
        }
    },
    "Compatibility": {
        "SchemaObject": "1.0"
    }
}

Read Opportunity metadata (more)

Use the SchemaRead method to query the structure or metadata of entities in the database.

// POST https://api.maximizer.com/octopus/Read
// Authorization: Bearer <token>
{
    "Schema": {
        "Scope": {
            "Fields": {
                "Key": 1,
                "Alias": 1,
                "Type": 1,
                "Name": 1,
                "AppliesTo": 1,
                "Sortable": 1,
                "Nullable": 1,
                "Assignable": 1,
                "Queryable": 1,
                "Mandatory": 1,
                "Attributes": 1,
                "HasOption": 1,
                "DisplayValue": 1
            }
        },
        "Criteria": {
            "SearchQuery": {
                "Key": {
                    "$TREE": "/Opportunity"
                }
            }
        }
    },
    "Compatibility": {
        "SchemaObject": "1.0"
    }
}

FieldOptions

Read Opportunity FieldOptions - SalesProcessSetup

Use the AbEntryGetFieldOptions method to retrieve the options for table-valued fields of AbEntry objects.

// POST https://api.maximizer.com/octopus/Read
// Authorization: Bearer <token>
{
    "Opportunity": {
        "FieldOptions": {
            "SalesProcessSetup": [
                {
                    "Key": 1,
                    "DisplayValue": 1
                }
            ]
        }
    }
}

Read Opportunity FieldOptions - SalesStageSetup

Use the AbEntryGetFieldOptions method to retrieve the options for table-valued fields of AbEntry objects.

// POST https://api.maximizer.com/octopus/Read
// Authorization: Bearer <token>
{
    "Opportunity": {
        "FieldOptions": {
            "SalesStageSetup": [
                {
                    "Key": 1,
                    "ProbabilityClose": 1,
                    "DisplayValue": 1
                }
            ]
        },
        "Data": {
            // Mandatory
            // We need to know which SalesProcessSetup to retrieve the Stages from
            "SalesProcessSetupKey": "U2FsZXNQcm9jZXNzCURFRkFVTFQJMA=="
        }
    }
}

Read Opportunity FieldOptions - Reason

Use the AbEntryGetFieldOptions method to retrieve the options for table-valued fields of AbEntry objects.

// POST https://api.maximizer.com/octopus/Read
// Authorization: Bearer <token>
{
    "Opportunity": {
        "FieldOptions": {
            "Reason": [
                {
                    "Key": 1,
                    "DisplayValue": 1
                }
            ]
        }
    }
}

Read Opportunity FieldOptions - Category

Use the AbEntryGetFieldOptions method to retrieve the options for table-valued fields of AbEntry objects.

// POST https://api.maximizer.com/octopus/Read
// Authorization: Bearer <token>
{
    "Opportunity": {
        "FieldOptions": {
            "Category": [
                {
                    "Key": 1,
                    "DisplayValue": 1
                }
            ]
        }
    }
}

Read Opportunity FieldOptions - Product

Use the AbEntryGetFieldOptions method to retrieve the options for table-valued fields of AbEntry objects.

// POST https://api.maximizer.com/octopus/Read
// Authorization: Bearer <token>
{
    "Opportunity": {
        "FieldOptions": {
            "Product": [
                {
                    "Key": 1,
                    "DisplayValue": 1
                }
            ]
        }
    }
}

Read Opportunity FieldOptions - Rating

Use the AbEntryGetFieldOptions method to retrieve the options for table-valued fields of AbEntry objects.

// POST https://api.maximizer.com/octopus/Read
// Authorization: Bearer <token>
{
    "Opportunity": {
        "FieldOptions": {
            "Rating": [
                {
                    "Key": 1,
                    "DisplayValue": 1
                }
            ]
        }
    }
}

Read Opportunity FieldOptions - RevenueType

Use the AbEntryGetFieldOptions method to retrieve the options for table-valued fields of AbEntry objects.

// POST https://api.maximizer.com/octopus/Read
// Authorization: Bearer <token>
{
    "Opportunity": {
        "FieldOptions": {
            "RevenueType": [
                {
                    "Key": 1,
                    "DisplayValue": 1
                }
            ]
        }
    }
}

Read Opportunity FieldOptions - Status

Use the AbEntryGetFieldOptions method to retrieve the options for table-valued fields of AbEntry objects.

// POST https://api.maximizer.com/octopus/Read
// Authorization: Bearer <token>
{
    "Opportunity": {
        "FieldOptions": {
            "Status": [
                {
                    "Key": 1,
                    "DisplayValue": 1
                }
            ]
        }
    }
}

Read Opportunity FieldOptions - Leader

Use the AbEntryGetFieldOptions method to retrieve the options for table-valued fields of AbEntry objects.

// POST https://api.maximizer.com/octopus/Read
// Authorization: Bearer <token>
{
    "Opportunity": {
        "FieldOptions": {
            "Leader": [
                {
                    "Uid": 1,
                    "Key": 1,
                    "DisplayValue": 1
                }
            ]
        },
        "Options": {
            // Disabled users are not included by default. This option forces returning disabled users.
            "IncludeDisabled": true
        }
    }
}

Opportunity CRUD

Create - Opportunity

Use the AbEntryRead method to search for Address Book entries in the database.

// POST https://api.maximizer.com/octopus/Create
// Authorization: Bearer <token>
{
    "Opportunity": {
        "Data": {
            "Key": null, // Will be generated automatically
            "AbEntryKey": "QWJFbnRyeQkyMjA1MDUyNTE1MzY1OTg0NTAwMDVDCTA=", // Mandatory
            "Objective": "Test Objective", // Mandatory
            "Description": "Test Description",
            "Status": 2, // In Progress - Check FieldOptions for possible values
            "Cost": 1234.56,
            "ForecastRevenue": 5678.90,
            "StartDate": "2025-01-02T12:00:00Z",
            "Leader": {
                "Uid": "MASTER"
            },
            "SalesTeam/Key": "U2FsZXNUZWFtCTY1NTM1",
            "NextAction": "Develop solution",
            "SalesProcessSetupKey": "U2FsZXNQcm9jZXNzCURFRkFVTFQJMA==", // Check FieldOptions for possible values
            "SalesStageSetupKey": "U2FsZXNQcm9jZXNzU3RhZ2VTZXR1cAkyMjA0MTEyNTE1NTg1NzQxNDAwMDFHCTA=",//Check FieldOptions for possible values related to SalesProcessSetupKey
            "Category": [ // Check FieldOptions for possible values
                "1"
            ],
            "Product": [ // Check FieldOptions for possible values
                "1",
                "2"
            ],
            "Rating": [ // Check FieldOptions for possible values
                "57998"
            ],
            "RevenueType": "60001" // Check FieldOptions for possible values
        }
    }
}

Read - Opportunity

Use the AbEntryRead method to search for Address Book entries in the database.

// POST https://api.maximizer.com/octopus/Read
// Authorization: Bearer <token>
{
    "Opportunity": {
        "Scope": {
            "Fields": {
                "Key": 1,
                "AbEntryKey": 1,
                "Objective": 1,
                "Description": 1,
                "Status": {
                    "Key": 1,
                    "DisplayValue": 1
                },
                "Cost": 1,
                "ForecastRevenue": 1,
                "StartDate": 1,
                "SalesTeam/Key": 1,
                "NextAction": 1,
                "SalesProcessSetupKey": 1,
                "SalesStageSetupKey": 1,
                "Reason": [
                    {
                        "Key": 1,
                        "DisplayValue": 1
                    }
                ],
                "Category": [
                    {
                        "Key": 1,
                        "DisplayValue": 1
                    }
                ],
                "Product": [
                    {
                        "Key": 1,
                        "DisplayValue": 1
                    }
                ],
                "Rating": [
                    {
                        "Key": 1,
                        "DisplayValue": 1
                    }
                ],
                "RevenueType": [
                    {
                        "Key": 1,
                        "DisplayValue": 1
                    }
                ]
            }
        },
        "Criteria": {
            "SearchQuery": {},
            "Top": 3
        }
    }
}

Update - Opportunity

Use the AbEntryRead method to search for Address Book entries in the database.

// POST https://api.maximizer.com/octopus/Update
// Authorization: Bearer <token>
{
    "Opportunity": {
        "Data": {
            "Key": "T3Bwb3J0dW5pdHkJMjUwMTAzMjUxNTM2NTg1MTMwMDA5Twkw", // Mandatory
            "Objective": "Test Objective updated",
            "Status": 3 // Won - See FieldOptions for possible values
        }
    }
}

Delete - Opportunity

Use the AbEntryRead method to search for Address Book entries in the database.

// POST https://api.maximizer.com/octopus/Delete
// Authorization: Bearer <token>
{
    "Opportunity": {
        "Data": {
            "Key": "T3Bwb3J0dW5pdHkJMjUwMTAzMjUxNTM2NTg1MTMwMDA5Twkw" // Mandatory
        }
    }
}