Consolidated API: Create Opportunity

  • Updated

Create Opportunity


POST /v2/thirdparty/opportunity/save

This is consolidated API to create opportunity, save quotes to opportunity and adding the opportunity comments. 


Parameters
OpportunityName  String

Name of the Opportunity.

OpportunityStartDate    DateTime

The start date and time of an opportunity.

OpportunityEndDate    DateTime

The end date and time of an opportunity.

DealValue    String

The deal value of an opportunity.

Probability    String

The probability of an opportunity.

ExpectedCloseDate    DateTime

The expected close date and time of an opportunity.

Pax    Long

The number of persons (PAX) which will be attending or present at the opportunity.

Owner    Object { Id, Name }

The owner of an opportunity that is available in your Priava account. The owner must exist in your Priava Account. Passed in JSON format where:
Id = the ID of the owner (This is an optional field).
Name = the name of the owner.

IdentifiedBy    Object { Id, Name }

The identifier of an opportunity that is available in your Priava account. The identifier must exist in your Priava Account. Passed in JSON format where:
Id = the ID of the identifier (This is an optional field).
Name = the name of the identifier.

EventType    Object { Id, Name }

The type of event that is available in your Priava account. The event type must exist in your Priava Account. Passed in JSON format where:
Id = the ID of the event type (This is an optional field).
Name = the name of the event type.

OpportunityStatus    Object { Id, Name }

The status of an Opportunity that is available in your Priava account. The opportunity status must exist in your Priava Account. Passed in JSON format where:
Id = the ID of the opportunity status (This is an optional field).
Name = the name of the opportunity status.

CustomFields Object

The custom fields for an Opportunity.

OpportunityNumber    String

The unique number of an Opportunity. Required when an opportunity is to be updated. If empty, a new opportunity will be created.

OpportunityContact    Array[{}]

The list of contacts is to be associated with the opportunity in JSON format.
IsPrimary(Boolean) =.Is the given contact a primary contact of the opportunity.
Firstname= Firstname of the contact.
Lastname = Last name of the contact.
Email = Email of the contact.
Phone = Phone number of the contact.
Organisation = Organisation of the contact (This is an optional field).
ContactType = Contact type of the contact for the opportunity.

LostReason    Object

The lost reason for the opportunity in JSON format. The lost reason must exist in your Priava Account. Passed in JSON format where:
Id = the ID of the lost reason (This is an optional field).
Name = the name of the lost reason.

Venues    Array [{}]

The list of venues to be added to the opportunity. The venue must exist in your Priava Account. Passed in JSON format where:
TemplateId = The template id of the venue.
StartDate= Start date of the venue booking.
EndDate = Start date of the venue booking.
Pax = Pax for the venue booking.
CatalogueComments = Any comment to be associated with the venue booking.
OpportunityStatus = The status of the venue booking.

OpportunityComments   Array [{}]

The note to be associated with the opportunity.
Note= The comment to be added to the Opportunity.
NoteType= The type of comment being added. This comment type must exist in your Priava account. Passed in JSON format where:
    Id = the ID of the comment type (This is an optional field).
    Name = the name of the comment type.
AddDocuments(Array[{}]) = The documents to be added to the note
   FileName = the name of the file/document.
   Content = the content of the file in base64 encoded format.

Quotes    Array [{}]
The list of quotes to be added to the opportunity.
Name = The name of the quote.
Comment= Any comment to be added to the quote.
QuoteNumber = The quote number (Note: Required only while updating a quote).
CatalogueItems = List of catalogue items to be associated with a quote.
CatalogueItems   Array [{}]
Id  Long

The Id of the catalogue item. Required only if you are updating the catalogue. If empty, a new catalogue item will be created.

Qty    Double

The Quantity of the catalogue item.

TemplateId    Long

The Template Id of the catalogue item.

StartDate    DateTime

The Start Date and time of catalogue item.

EndDate    DateTime

The End Date and time of catalogue item.

UnitPrice    Double

The Unit Price of the catalogue item.

DiscountType    Double

This represents the type of discount provided. The possible values could be 'P' and 'C', where 'P' is the percentile discount and 'C' is a fixed discount amount.

DiscountValue    Double

This represents the Discount provided for the catalogue item. The value provided is used along with the discount type to calculate the total discount amount.

TaxType    Object { Id, Name }

The Tax Type to be associated with the catalogue item. The Tax Type must exist in your Priava Account. Passed in JSON format where:
Id = the ID of the Tax Type (This is an optional field).
Name = the name of the Tax Type.

FinancialComments    String

The Financial Comment to be associated with the catalogue item. 

CatalogueComments    String

The Comment to be associated with the catalogue item.

CreditOrDebit    String

This represents whether the catalogue item should be credited or debited to the opportunity. Only values supported are Credit or Debit.

Formula    Object

Formula associated with the catalogue item contains the following:
Name = the name of the Formula.
Id = the ID of the Tax Type (This is an optional field).
CustomFormulaFields = The Custom Formula Fields passed in JSON Format where:
    FieldName= Name of the Custom Formula Field
    FieldValue= Value of the Custom Formula Field

{

    "OpportunityName""Birthday Party",
    "OpportunityStartDate""11/10/2020 09:00",
    "DealValue"100.5,
    "OpportunityEndDate""11/10/2020 17:30",
    "Probability"10.5,
    "ExpectedCloseDate"null,
    "Pax"0,
    "Owner": {
        "Email""john.smith@example.com"
   },
    "IdentifiedBy": {
        "Email""john.smith@example.com"
   },
    "EventType": {
        "Name""EventTypeName"
   },
    "OpportunitySource": {
        "Name""Advertising"
   },
    "CustomFields": {
        "CFText""customField value",
        "CFDropdown": [
            "DD1",
            "DD2"
       ]
   },
    "OpportunityStatus": {
        "Name""Web Enquiry"
    },

    "OpportunityNumber""",
    "OpportunityContacts": [
       {
            "IsPrimary"true,
            "Firstname""john",
            "Email""john.smith@example.com",
            "Phone""+91-9999999999",
            "Organisation""example",
            "Lastname""smith",
            "ContactType": {
                "Name""NewContactType"
           }
       }
   ],
    "LostReason": {},
    "Venues": [
       {
           "StartDate""11/10/2020 09:00",
            "EndDate""11/10/2020 17:30",
            "Pax": 10,
            "OpportunityStatus": {
                "Name""Web Enquiry",
           },
            "CatalogueComments""",
            "TemplateId"54579
       }
   ],
    "Quotes": [
       {
            "Name""quote1",
            "Comment""",
            "QuoteNumber""",
            "CatalogueItems": {
                "Beverage": [
                   {
                        "Name""Cold Drinks",
                        "Qty"100,
                        "DiscountType""C",
                        "DiscountValue"0,
                        "TaxType": {
                            "Name""GST - Standard 10%"
                       },
                        "Formula": {},
                        "UnitPrice"10,
                        "CatalogueComments""",
                        "FinancialComments""",
                        "StartDate""11/10/2020 09:00",
                        "EndDate""11/10/2020 17:30",
                        "TemplateId"100252819
                   }
               ],
                "Food": [
                   {
                        "Name""Sandwich",
                        "Qty"100,
                        "DiscountType""C",
                        "DiscountValue"0,
                        "TaxType": {
                            "Name""GST"
                       },
                        "Formula": {},
                        "UnitPrice"10,
                        "CatalogueComments""",
                        "FinancialComments""",
                        "StartDate""11/10/2020 09:00",
                        "EndDate""11/10/2020 17:30",
                        "TemplateId"100309543
                   }
               ]
           }
       }
   ],
    "OpportunityComments": [
       {
            "NoteType": {
                "Name""System"
           },
            "Note""This is my comment",
            "AddDocuments": [],
            "RenameDocuments": []
       }
   ]
}
Response:
{
    "success": true,
"result": {
OpportunityNumber: "364"
OpportunityId: 100016349
} }

 

Was this article helpful?

Have more questions? Submit a request