Configure onProductCreate and onProductUpdate

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.

onProductCreate

When a product is created in the Freshsales Suite system, the onProductCreate is invoked and the registered callback method is executed.

Subscribe to the onProductCreate event and register the callback by using the following sample manifest.json content.

manifest.json
"events": {
  "onProductCreate": {
    "handler": "onProductCreateCallback"
  }
}

Define the corresponding callback by using the following sample server.js content:

server.js
exports = {
  onProductCreateCallback: function(payload) {
   console.log("Logging arguments from onProductCreate event: " + JSON.stringify(payload));
  }
}

Attributes of the data object

  • actorobject

    Information pertaining to the entity who triggered the onProductCreate event in the Freshsales Suite system.

    • idinteger

      Identifier of the actor who triggered the product event.
      The value of this attribute is 0 when the value of actor.type is system.

    • namestring

      Full name of the actor.

    • typestring

      Name of the entity that triggered the onProductCreate event.
      Possible value: system

  • associationsobject

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

    • creatorobject

      Details of the user who created the task.

      • created_atstring

        Timestamp of when the user is created in the Freshsales Suite system, specified in the UTC format.

      • deal_pipeline_idinteger

        Pipeline helps define different stages a deal progresses through, which enables a unique sales process for each deal.
        Identifier of the pipeline associated with the deal.

      • emailstring

        Email address of the user.

      • idinteger

        Identifier of the user.

      • is_activeboolean

        Specifies whether the user is currently active in the Freshsales Suite system.
        Possible value: true, false

      • job_titlestring

        Designation of the user in the Freshsales Suite system.

      • mobile_numberstring

        Contact number of the user.

      • namestring

        Name of the user.

      • time_zonestring

        Time zone of the user configured in the Freshsales Suite system.

      • typestring

        Identifier of the person involved in creating, owning, or updating the product.
        Possible value: user

      • updated_atstring

        Timestamp of when the user is last updated in the Freshsales Suite system, specified in the UTC format.

      • uuidstring

        Unique user identifier, this value is auto-generated.

      • work_numberstring

        Official phone number of the user.

    • ownerobject

      Details of the user who created the task.

      • created_atstring

        Timestamp of when the user is created in the Freshsales Suite system, specified in the UTC format.

      • deal_pipeline_idinteger

        Pipeline helps define different stages a deal progresses through, which enables a unique sales process for each deal.
        Identifier of the pipeline associated with the deal.

      • emailstring

        Email address of the user.

      • idinteger

        Identifier of the user.

      • is_activeboolean

        Specifies whether the user is currently active in the Freshsales Suite system.
        Possible value: true, false

      • job_titlestring

        Designation of the user in the Freshsales Suite system.

      • mobile_numberstring

        Contact number of the user.

      • namestring

        Name of the user.

      • time_zonestring

        Time zone of the user configured in the Freshsales Suite system.

      • typestring

        Identifier of the person involved in creating, owning, or updating the product.
        Possible value: user

      • updated_atstring

        Timestamp of when the user is last updated in the Freshsales Suite system, specified in the UTC format.

      • uuidstring

        Unique user identifier, this value is auto-generated.

      • work_numberstring

        Official phone number of the user.

    • product_pricingsarray of objects

      Information pertaining to the pricing of the created product.

      • billing_cycleinteger

        Frequency of billing for the product added to the document.
        If the product has one-time billing, billing_cycle is null.

      • billing_typeinteger

        Identifier of the billing type of the product added to the document.
        Possible values:
        1: monthly subscription
        2: quarterly subscription
        2: half-yearly subscription
        4: annual subscription

        For products with one-time billing, the value of billing_type is null.

        Note:Billing type for the product cannot be changed once configured.

      • created_atstring

        Timestamp of when the product is created in the Freshsales Suite system, specified in the UTC format.

      • currency_codestring

        Currency in which the product’s value is expressed, specified in the ISO 4217 format.

      • idinteger

        Identifier of product, auto-generated when the product is created in the Freshsales Suite system.

      • setup_feestring

        Setting up fees, if any, for the product added to the document.

      • unit_priceinteger

        Price per unit of the product added to the document.

    • updaterobject

      Details of the user who created the task.

      • created_atstring

        Timestamp of when the user is created in the Freshsales Suite system, specified in the UTC format.

      • deal_pipeline_idinteger

        Pipeline helps define different stages a deal progresses through, which enables a unique sales process for each deal.
        Identifier of the pipeline associated with the deal.

      • emailstring

        Email address of the user.

      • idinteger

        Identifier of the user.

      • is_activeboolean

        Specifies whether the user is currently active in the Freshsales Suite system.
        Possible value: true, false

      • job_titlestring

        Designation of the user in the Freshsales Suite system.

      • mobile_numberstring

        Contact number of the user.

      • namestring

        Name of the user.

      • time_zonestring

        Time zone of the user configured in the Freshsales Suite system.

      • typestring

        Identifier of the person involved in creating, owning, or updating the product.
        Possible value: user

      • updated_atstring

        Timestamp of when the user is last updated in the Freshsales Suite system, specified in the UTC format.

      • uuidstring

        Unique user identifier, this value is auto-generated.

      • work_numberstring

        Official phone number of the user.

  • productobject

    Information pertaining to the product created in the Freshsales Suite system.

    • categorystring

      Name of the category associated with the product.
      For example, hardware, software, maintenance, and so on. Custom categories can be created in the account as per requirements.

    • created_atstring

      Timestamp of when the product is created in the Freshsales Suites system, specified in the UTC format.

    • creator_idinteger

      Identifier of the user who created the product.

    • custom_fieldsobject

      Information pertaining to the product’s custom fields, which are configured in the account to display additional product information.
      Attributes within this object are key-value pairs representing name and value of the custom field respectively.

    • descriptionstring

      Summary of the product.

    • idinteger

      Identifier of the product object, auto-generated when a product is created in the Freshsales Suite system.

    • import_csv_idinteger

      Identifier of the CSV file uploaded into the Freshsales Suite system for importing product details.
      Product details can be imported, in bulk, into the account through CSV files. For more information on importing products, see How to import products into Freshsales.

    • import_idinteger

      Identifier of the import task that creates the product in the Freshsales Suite system.

    • is_activeboolean

      Specifies whether the product is available for sale currently.
      Possible values: true, false

    • is_deletedboolean

      Specifies whether the product details are deleted from the Freshsales Suite system.

      Possible values: true, false

    • namestring

      Name of the product.

    • parent_productinteger

      Identifier of the parent product.

      A product created in the Freshsales Suite system can be added as a subsidiary product of a primary/parent product.

      The value of this attribute is a valid product.id.

    • product_codestring

      Value of the product code associated with the product.

    • sku_numberstring

      Stock keeping unit number associated with the product.

    • updated_atstring

      Timestamp of when the product details are last updated in the Freshsales Suite system, specified in the UTC format.
      For onProductCreate, the value of this attribute is the same as the created_at value.

    • valid_tillstring

      Date till when the product is available in the Freshsales Suite system, specified as a timestamp in the UTC format.

onProductUpdate

The onProductUpdate event is triggered when,

  • A product’s details are modified.
  • A product is soft deleted.
  • A product’s pricing details are modified.

Subscribe to the onProductUpdate event and register the callback by using the following sample manifest.json content.

manifest.json
"events": {
  "onProductUpdate": {
    "handler": "onProductUpdateCallback"
  }
}

Define the corresponding callback by using the following sample server.js content:

server.js
exports = {
  onProductUpdateCallback: function(payload) {
    console.log("Logging arguments from onProductUpdate event: " + JSON.stringify(payload));
  }
}

Attributes of the data object

  • actorobject

    Information pertaining to the entity who triggered the onProductUpdate event in the Freshsales Suite system.

    • idinteger

      Identifier of the actor who triggered the product event. The value of this attribute is 0 when the value of actor.type is system.

    • namestring

      Full name of the actor.

    • typestring

      Name of the entity that triggered the onProductUpdate event.

      Possible value: system

  • associationsobject

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

    • creatorobject

      Details of the user who created the task.

      • created_atstring

        Timestamp of when the user is created in the Freshsales Suite system, specified in the UTC format.

      • deal_pipeline_idinteger

        Pipeline helps define different stages a deal progresses through, which enables a unique sales process for each deal.
        Identifier of the pipeline associated with the deal.

      • emailstring

        Email address of the user.

      • idinteger

        Identifier of the user.

      • is_activeboolean

        Specifies whether the user is currently active in the Freshsales Suite system.
        Possible value: true, false

      • job_titlestring

        Designation of the user in the Freshsales Suite system.

      • mobile_numberstring

        Contact number of the user.

      • namestring

        Name of the user.

      • time_zonestring

        Time zone of the user configured in the Freshsales Suite system.

      • typestring

        Identifier of the person involved in creating, owning, or updating the product.
        Possible value: user

      • updated_atstring

        Timestamp of when the user is last updated in the Freshsales Suite system, specified in the UTC format.

      • uuidstring

        Unique user identifier, this value is auto-generated.

      • work_numberstring

        Official phone number of the user.

    • ownerobject

      Details of the user who created the task.

      • created_atstring

        Timestamp of when the user is created in the Freshsales Suite system, specified in the UTC format.

      • deal_pipeline_idinteger

        Pipeline helps define different stages a deal progresses through, which enables a unique sales process for each deal.
        Identifier of the pipeline associated with the deal.

      • emailstring

        Email address of the user.

      • idinteger

        Identifier of the user.

      • is_activeboolean

        Specifies whether the user is currently active in the Freshsales Suite system.
        Possible value: true, false

      • job_titlestring

        Designation of the user in the Freshsales Suite system.

      • mobile_numberstring

        Contact number of the user.

      • namestring

        Name of the user.

      • time_zonestring

        Time zone of the user configured in the Freshsales Suite system.

      • typestring

        Identifier of the person involved in creating, owning, or updating the product.
        Possible value: user

      • updated_atstring

        Timestamp of when the user is last updated in the Freshsales Suite system, specified in the UTC format.

      • uuidstring

        Unique user identifier, this value is auto-generated.

      • work_numberstring

        Official phone number of the user.

    • product_pricingsarray of objects

      Information pertaining to the pricing of the created product.

      • billing_cycleinteger

        Frequency of billing for the product added to the document.
        If the product has one-time billing, billing_cycle is null.

      • billing_typeinteger

        Identifier of the billing type of the product added to the document.
        Possible values:
        1: monthly subscription
        2: quarterly subscription
        2: half-yearly subscription
        4: annual subscription For products with one-time billing, the value of billing_type is null.

      • created_atstring

        Timestamp of when the product is created in the Freshsales Suite system, specified in the UTC format.

      • currency_codestring

        Currency in which the product’s value is expressed, specified in the ISO 4217 format.

      • idinteger

        Identifier of product, auto-generated when the product is created in the Freshsales Suite system.

      • setup_feestring

        Setting up fees, if any, for the product added to the document.

      • unit_priceinteger

        Price per unit of the product added to the document.

    • updaterobject

      Details of the user who created the task.

      • created_atstring

        Timestamp of when the user is created in the Freshsales Suite system, specified in the UTC format.

      • deal_pipeline_idinteger

        Pipeline helps define different stages a deal progresses through, which enables a unique sales process for each deal.
        Identifier of the pipeline associated with the deal.

      • emailstring

        Email address of the user.

      • idinteger

        Identifier of the user.

      • is_activeboolean

        Specifies whether the user is currently active in the Freshsales Suite system.
        Possible value: true, false

      • job_titlestring

        Designation of the user in the Freshsales Suite system.

      • mobile_numberstring

        Contact number of the user.

      • namestring

        Name of the user.

      • time_zonestring

        Time zone of the user configured in the Freshsales Suite system.

      • typestring

        Identifier of the person involved in creating, owning, or updating the product.
        Possible value: user

      • updated_atstring

        Timestamp of when the user is last updated in the Freshsales Suite system, specified in the UTC format.

      • uuidstring

        Unique user identifier, this value is auto-generated.

      • work_numberstring

        Official phone number of the user.

  • changesobject

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

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

    Example

    "changes": {
      "model_changes": {
        "name": [
          "Samsung",
          "Apple"
        ],
        "product_code": [
          "S11",
          "A01"
        ],
        "sku_number": [
          "MOSA12309",
          "A12309"
        ]
      },
      "system_changes": {},
      "misc_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. Note:If a product’s deletion triggers the onProductUpdate event, the is_deleted attribute is set to true and the is_deleted attribute is present as part of the changes object.

    • system_changesobject

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

  • productobject

    Information pertaining to the product created in the Freshsales Suite system.

    • categorystring

      Name of the category associated with the product.
      For example, hardware, software, maintenance, and so on. Custom categories can be created in the account as per requirements.

    • created_atstring

      Timestamp of when the product is created in the Freshsales Suites system, specified in the UTC format.

    • creator_idinteger

      Identifier of the user who created the product.

    • custom_fieldsobject

      Information pertaining to the product’s custom fields, which are configured in the account to display additional product information.
      Attributes within this object are key-value pairs representing name and value of the custom field respectively.

    • descriptionstring

      Summary of the product.

    • idinteger

      Identifier of the product object, auto-generated when a product is created in the Freshsales Suite system.

    • import_csv_idinteger

      Identifier of the CSV file uploaded into the Freshsales Suite system for importing product details.
      Product details can be imported, in bulk, into the account through CSV files. For more information on importing products, see How to import products into Freshsales.

    • import_idinteger

      Identifier of the import task that creates the product in the Freshsales Suite system.

    • is_activeboolean

      Specifies whether the product is available for sale currently.
      Possible values: true, false

    • is_deletedboolean

      Specifies whether the product details are deleted from the Freshsales Suite system.
      Possible values: true, false

    • namestring

      Name of the product.

    • parent_productinteger

      Identifier of the parent product.
      A product created in the Freshsales Suite system can be added as a subsidiary product of a primary/ parent product.
      The value of this attribute is a valid product.id.

    • product_codestring

      Value of the product code associated with the product.

    • sku_numberstring

      Stock keeping unit number associated with the product.

    • updated_atstring

      Timestamp of when the product details are last updated in the Freshsales Suite system, specified in the UTC format.
      For onProductCreate, the value of this attribute is the same as the created_at value.

    • valid_tillstring

      Date till when the product is available in the Freshsales Suite system, specified as a timestamp in the UTC format.