Offer

Overview

Offer is a product included in a proposal.

Fields usually used

FieldsDescription
createdAtthe timestamp when the offer was created
createdBythe id of entity who create the offer
endDatethe endDate of the offer
eventsa list of change events happened to the offer
fieldsdynamic fields associated with the offer (usually in form of json)
idthe id automatically generated when the offer was created
lastModifiedAtthe timestamp when the offer was last modified
lastModifiedBythe id of entity who last modified the offer
offerNumbera string indicating the offerNumber of the offer for reference
pricinginformation on pricing, which is the result of execution of pricing scripts
productthe product associated with the offer
stakeHoldersa list of entities who are stakeHolders of the offer
statusthe status of the offer
startDatethe startDate of the offer

To see a full list of fields please visit our Playground

Add Offer to Proposal

Query Examples

mutation addOfferToProposal(
  $caseId:String!
  $proposalId:String!
  $input:addOfferInput!
) {
  addOfferToProposal(
    caseId: $caseId
    proposalId: $proposalId
    input: $input
  ){
    status 
    createdStatus { id } 
    errors
  }
}

Input:

{
  "caseId": "c1e3c643-085c-4e41-abfe-ba366fbbf714",
  "proposalId": "98fe72db-bc18-4ca7-9709-eacc3ae840bf",
  "input": {
    "productId": { 
      "type": "Demo Insurance",
      "version":"1",
      "plan":"Demo Insurance Plan 1"
    }
  }
}

Example Result:

{
  "data": {
    "addOfferToProposal": {
      "status": "success",
      "createdStatus": {
        "id": "8702d7b4-63fb-4797-a7bb-2941fbf946ac"
      },
      "errors": null
    }
  }
}

Querying Offer of Proposal in Case

Query Examples

query casesOffer($caseWhere:caseWhere, $proposalWhere:proposalWhere){
  cases (where: $caseWhere){
    list{
      proposals(where: $proposalWhere) {
        id
        basket {
          createdAt
          createdBy { id }
          endDate
          events { type timestamp }
          fields
          id
          lastModifiedAt
          lastModifiedBy { id }
          offerNumber
          pricing
          product { productId { type plan version } }
          stakeholders { id }
          status
          startDate
        }
      }
    }
  }
}

Input:

{
  "caseWhere": { "id": "c1e3c643-085c-4e41-abfe-ba366fbbf714"},
  "proposalWhere": { "id": "98fe72db-bc18-4ca7-9709-eacc3ae840bf" }
}

Example Result:

{
  "data": {
    "cases": {
      "list": [
        {
          "proposals": [
            {
              "id": "98fe72db-bc18-4ca7-9709-eacc3ae840bf",
              "basket": [
                {
                  "createdAt": "2021-04-29T02:24:55.074Z",
                  "createdBy": {
                    "id": "60810024052f07644d0c3495"
                  },
                  "endDate": null,
                  "events": [
                    {
                      "type": "addOffer",
                      "timestamp": "2021-04-29T02:24:55.074Z"
                    }
                  ],
                  "fields": null,
                  "id": "3ead6122-e85b-4074-a2aa-fd6bb1489453",
                  "lastModifiedAt": "2021-04-29T02:24:55.074Z",
                  "lastModifiedBy": {
                    "id": "60810024052f07644d0c3495"
                  },
                  "offerNumber": "2Y83IQ",
                  "pricing": null,
                  "product": {
                    "productId": {
                      "type": "Demo Insurance",
                      "plan": "Demo Insurance Plan 1",
                      "version": "1"
                    }
                  },
                  "stakeholders": null,
                  "status": null,
                  "startDate": null
                },
                {
                  "createdAt": "2021-04-29T02:26:22.765Z",
                  "createdBy": {
                    "id": "60810024052f07644d0c3495"
                  },
                  "endDate": null,
                  "events": [
                    {
                      "type": "addOffer",
                      "timestamp": "2021-04-29T02:26:22.765Z"
                    }
                  ],
                  "fields": null,
                  "id": "8702d7b4-63fb-4797-a7bb-2941fbf946ac",
                  "lastModifiedAt": "2021-04-29T02:26:22.765Z",
                  "lastModifiedBy": {
                    "id": "60810024052f07644d0c3495"
                  },
                  "offerNumber": "8YYGQ5",
                  "pricing": null,
                  "product": {
                    "productId": {
                      "type": "Demo Insurance",
                      "plan": "Demo Insurance Plan 1",
                      "version": "1"
                    }
                  },
                  "stakeholders": null,
                  "status": null,
                  "startDate": null
                }
              ]
            }
          ]
        }
      ]
    }
  }
}

A Note on Fields

Offer.fields are dynamic data associated with the offer. Literally, you can add anything in fields.

One example usecase of fields is it can be used as the dataInput of pricing calculation for the offer For more information, please refer to Script.

.