Configure onDealCreate and onDealUpdate

Marketplace Platform v2.3 deprecation:We’re continuing to improve the Marketplace Platform to deliver stronger security, better performance, and new capabilities. As part of this evolution, Marketplace Platform v2.3 will be deprecated. To learn the dates and next steps, see Migration guide.

onDealCreate

When a deal is created, the onDealCreate event is invoked and the registered callback method is executed.

Subscribe to the onDealCreate event, register the callback, and define the corresponding callback by using the following sample server.js content.

server.js
exports = {
  events: [
    { event: "onDealCreate", callback: "onDealCreateCallback" }
  ],
  onDealCreateCallback: function(payload) {
    console.log("Logging arguments from onDealCreate event: " + JSON.stringify(payload));
  }
}

Attributes of the data object

  • associationsobject

    All associated objects of the deal object, which specify additional information pertaining to the deal created.

    • campaignstring

      UTM campaign.

    • contactsarray of strings

      Contacts associated with this deal.

    • creatorobject

      Details of the deal creator.

      • created_atdatetime

        Creation timestamp.

      • deal_pipeline_idinteger

        ID of deal pipelines that this user is part of.

      • emailstring

        Primary email of the user.

      • idinteger

        ID of the user.

      • is_activeboolean

        Set to 'true' if the user is verified.

      • job_titlestring

        Job title of the user.

      • mobile_numberstring

        Mobile number of the user.

      • namestring

        Name of the user.

      • time_zonestring

        Time zone of the user in UTC format.

      • typestring

        Helps categorize a user.

      • updated_atdatetime

        Updated timestamp.

      • work_numberstring

        Phone number of the user.

    • currencyobject

      Details of the deal currency.

      • currency_codestring

        Code for the currency.

      • exchange_ratenumber

        Exchange rate for the currency.

      • idnumber

        ID of currency.

    • deal_payment_statusstring

      Status of the deal payment.

    • deal_pipelineobject

      Details of deal pipeline.

      • idnumber

        ID of the deal pipeline.

      • is_defaultboolean

        Set to 'true' for the default pipeline.

      • namestring

        Name of the deal pipeline.

      • positionnumber

        Position of the deal.

    • deal_productstring

      Product that the deal is associated with.

    • deal_reasonstring

      Reason why the deal was lost.

    • deal_stageobject

      Details of the deal stage.

      • forecast_typestring

        Category to which the deal stage belongs to.

      • idnumber

        ID of the deal stage.

      • namestring

        Name of the deal stage.

      • positionnumber

        Position of the deal stage.

    • deal_typestring

      Type of deal.

    • ownerobject

      Details of the deal owner.

      • created_atdatetime

        Creation timestamp.

      • deal_pipeline_idinteger

        ID of deal pipelines that this user is part of.

      • emailstring

        Primary email of the user.

      • idinteger

        ID of the user.

      • is_activeboolean

        Set to 'true' if the user is verified.

      • job_titlestring

        Job title of the user.

      • mobile_numberstring

        Mobile number of the user.

      • namestring

        Name of the user.

      • time_zonestring

        Time zone of the user in UTC format.

      • typestring

        Helps categorize a user.

      • updated_atdatetime

        Updated timestamp.

      • work_numberstring

        Phone number of the user.

    • sourcestring

      Source details of this deal.

    • territorystring

      Location of the deal.

    • updaterstring

      User who updated the deal.

      • created_atdatetime

        Creation timestamp.

      • deal_pipeline_idinteger

        ID of deal pipelines that this user is part of.

      • emailstring

        Primary email of the user.

      • idinteger

        ID of the user.

      • is_activeboolean

        Set to 'true' if the user is verified.

      • job_titlestring

        Job title of the user.

      • mobile_numberstring

        Mobile number of the user.

      • namestring

        Name of the user.

      • time_zonestring

        Time zone of the user in UTC format.

      • typestring

        Helps categorize a user.

      • updated_atdatetime

        Updated timestamp.

      • work_numberstring

        Phone number of the user.

  • dealobject

    Information pertaining to the deal created.

    • active_sales_sequencesobject

      Active sales campaigns that this deal was part of.

    • ageobject

      Time elapsed (in days) since the creation of the deal.

    • amountobject

      Value of the deal.

    • base_currency_amountobject

      Deal amount converted to base currency configured by admin.

    • campaign_idobject

      ID of the UTM campaign.

    • closed_dateobject

      Closed date of the deal.

    • completed_sales_sequencesobject

      Completed sales sequences that this deal was part of.

    • contact_idsarray of numbers

      IDs of contacts associated with this deal.

    • created_atobject

      Creation timestamp.

    • creator_idobject

      ID of the user who created the deal.

    • currency_idobject

      ID of currency associated with the deal.

    • custom_fieldsarray of strings

      Key value pairs containing the names and values of custom fields.

    • deal_payment_status_idobject

      ID of deal payment status.

    • deal_pipeline_idobject

      ID of deal pipeline.

    • deal_product_idobject

      ID of the product that the deal is associated with.

    • deal_reason_idobject

      ID of the reason why the deal was lost.

    • deal_stage_idobject

      ID of the deal stage.

    • deal_type_idobject

      ID of the deal type.

    • expected_closeobject

      Expected close date of the deal.

    • expected_deal_valueobject

      Expected deal amount.

    • first_assigned_atobject

      First assigned timestamp of the deal.

    • idinteger

      ID of the deal.

    • import_csv_idobject

      Reference of all imports that this deal was part of.

    • import_idstring

      ID of the equivalent record in the external system from which it was imported.

    • is_deletedboolean

      Set to 'true' if deal is deleted.

    • last_assigned_atobject

      Last assigned timestamp.

    • last_contacted_sales_activity_modeobject

      Last mode of sales activity rendered for the deal.

    • last_contacted_via_sales_activitydatetime

      Last contacted timestamp (through sales activity).

    • lead_source_idobject

      ID of the source of the deal.

    • lost_fromstring

      Stage where the deal was lost.

    • nameobject

      Name of the deal.

    • owner_idobject

      User who owns the record.

    • probabilityobject

      Probability of closing the deal.

    • recent_noteobject

      Recently added note against the deal.

    • sales_account_idobject

      ID of sales account associated with this deal.

    • stage_updated_timeobject

      Timestamp when the deal stage was updated.

    • tagsobject

      Tags associated with this deal.

    • territoryobject

      Location of the deal.

    • upcoming_activities_timeobject

      Timestamp for next scheduled activity.

    • updated_atobject

      Updated timestamp.

    • updater_idobject

      ID of the user who updated the deal.

    • web_form_idobject

      Form through which this deal was captured.

    • won_fromstring

      Stage from which deal was won.

onDealUpdate

When a deal is updated, the onDealUpdate event is invoked and the registered callback method is executed.

Subscribe to the onDealUpdate event, register the callback, and define the corresponding callback by using the following sample server.js content.

server.js
exports = {
  events: [
    { event: "onDealUpdate", callback: "onDealUpdateCallback" }
  ],
  onDealUpdateCallback: function(payload) {
    console.log("Logging arguments from onDealUpdate event: " + JSON.stringify(payload));
  }
}

Attributes of the data object

  • associationsobject

    All associated objects of the deal object, which specify additional information pertaining to the deal updated.

    • campaignstring

      UTM campaign.

    • contactsarray of strings

      Contacts associated with this deal.

    • creatorobject

      Details of the deal creator.

      • created_atdatetime

        Creation timestamp.

      • deal_pipeline_idinteger

        ID of deal pipelines that this user is part of.

      • emailstring

        Primary email of the user.

      • idinteger

        ID of the user.

      • is_activeboolean

        Set to 'true' if the user is verified.

      • job_titlestring

        Job title of the user.

      • mobile_numberstring

        Mobile number of the user.

      • namestring

        Name of the user.

      • time_zonestring

        Time zone of the user in UTC format.

      • typestring

        Helps categorize a user.

      • updated_atdatetime

        Updated timestamp.

      • work_numberstring

        Phone number of the user.

    • currencyobject

      Details of the deal currency.

      • currency_codestring

        Code for the currency.

      • exchange_ratenumber

        Exchange rate for the currency.

      • idnumber

        ID of currency.

    • deal_payment_statusstring

      Status of the deal payment.

    • deal_pipelineobject

      Details of deal pipeline.

      • idnumber

        ID of the deal pipeline.

      • is_defaultboolean

        Set to 'true' for the default pipeline.

      • namestring

        Name of the deal pipeline.

      • positionnumber

        Position of the deal.

    • deal_productstring

      Product that the deal is associated with.

    • deal_reasonstring

      Reason why the deal was lost.

    • deal_stageobject

      Details of the deal stage.

      • forecast_typestring

        Category to which the deal stage belongs to.

      • idnumber

        ID of the deal stage.

      • namestring

        Name of the deal stage.

      • positionnumber

        Position of the deal stage.

    • deal_typestring

      Type of deal.

    • ownerobject

      Details of the deal owner.

      • created_atdatetime

        Creation timestamp.

      • deal_pipeline_idinteger

        ID of deal pipelines that this user is part of.

      • emailstring

        Primary email of the user.

      • idinteger

        ID of the user.

      • is_activeboolean

        Set to 'true' if the user is verified.

      • job_titlestring

        Job title of the user.

      • mobile_numberstring

        Mobile number of the user.

      • namestring

        Name of the user.

      • time_zonestring

        Time zone of the user in UTC format.

      • typestring

        Helps categorize a user.

      • updated_atdatetime

        Updated timestamp.

      • work_numberstring

        Phone number of the user.

    • sourcestring

      Source details of this deal.

    • territorystring

      Location of the deal.

    • updaterstring

      User who updated the deal.

      • created_atdatetime

        Creation timestamp.

      • deal_pipeline_idinteger

        ID of deal pipelines that this user is part of.

      • emailstring

        Primary email of the user.

      • idinteger

        ID of the user.

      • is_activeboolean

        Set to 'true' if the user is verified.

      • job_titlestring

        Job title of the user.

      • mobile_numberstring

        Mobile number of the user.

      • namestring

        Name of the user.

      • time_zonestring

        Time zone of the user in UTC format.

      • typestring

        Helps categorize a user.

      • updated_atdatetime

        Updated timestamp.

      • work_numberstring

        Phone number of the user.

  • changesobject

    Information pertaining to the contact whose details are modified in the Freshsales Classic system.

    Changes that triggered the onDealUpdate event, specified as a JSON object of the following format:

    "changes": {
      "misc_changes": {},
      "model_changes": {
        //For non-array attributes
        "<deal.attribute that changed>": ["Old value", "New value"]
      },
      "system_changes": {}
    }
    • misc_changesobject

      List of all miscellaneous database parameters whose values have changed, along with the old and modified values.

    • model_changesobject

      List of all attributes whose values have changed, along with the old and modified values of the attributes.

    • system_changesobject

      List of all system-level parameters whose values have changed, along with the old and modified values.

  • dealobject

    Information pertaining to the deal updated.

    • active_sales_sequencesobject

      Active sales campaigns that this deal was part of.

    • ageobject

      Time elapsed (in days) since the creation of the deal.

    • amountobject

      Value of the deal.

    • base_currency_amountobject

      Deal amount converted to base currency configured by admin.

    • campaign_idobject

      ID of the UTM campaign.

    • closed_dateobject

      Closed date of the deal.

    • completed_sales_sequencesobject

      Completed sales sequences that this deal was part of.

    • contact_idsarray of numbers

      IDs of contacts associated with this deal.

    • created_atobject

      Creation timestamp.

    • creator_idobject

      ID of the user who created the deal.

    • currency_idobject

      ID of currency associated with the deal.

    • custom_fieldsarray of strings

      Key value pairs containing the names and values of custom fields.

    • deal_payment_status_idobject

      ID of deal payment status.

    • deal_pipeline_idobject

      ID of deal pipeline.

    • deal_product_idobject

      ID of the product that the deal is associated with.

    • deal_reason_idobject

      ID of the reason why the deal was lost.

    • deal_stage_idobject

      ID of the deal stage.

    • deal_type_idobject

      ID of the deal type.

    • expected_closeobject

      Expected close date of the deal.

    • expected_deal_valueobject

      Expected deal amount.

    • first_assigned_atobject

      First assigned timestamp of the deal.

    • idinteger

      ID of the deal.

    • import_csv_idobject

      Reference of all imports that this deal was part of.

    • import_idstring

      ID of the equivalent record in the external system from which it was imported.

    • is_deletedboolean

      Set to 'true' if deal is deleted.

    • last_assigned_atobject

      Last assigned timestamp.

    • last_contacted_sales_activity_modeobject

      Last mode of sales activity rendered for the deal.

    • last_contacted_via_sales_activitydatetime

      Last contacted timestamp (through sales activity).

    • lead_source_idobject

      ID of the source of the deal.

    • lost_fromstring

      Stage where the deal was lost.

    • nameobject

      Name of the deal.

    • owner_idobject

      User who owns the record.

    • probabilityobject

      Probability of closing the deal.

    • recent_noteobject

      Recently added note against the deal.

    • sales_account_idobject

      ID of sales account associated with this deal.

    • stage_updated_timeobject

      Timestamp when the deal stage was updated.

    • tagsobject

      Tags associated with this deal.

    • territoryobject

      Location of the deal.

    • upcoming_activities_timeobject

      Timestamp for next scheduled activity.

    • updated_atobject

      Updated timestamp.

    • updater_idobject

      ID of the user who updated the deal.

    • web_form_idobject

      Form through which this deal was captured.

    • won_fromstring

      Stage from which deal was won.