Key Results methods

The UI Apps SDK enables you to perform CRUD operations with Key Results. For example, you can enable users to update the Key Result your UI app is currently loaded for.

NOTE: Before you start using the SDK methods, ensure you have imported and configured the SDK first.

NOTE: In the Quantive Results REST API and UI Apps SDK, Key Results are referred to as metrics, thus all methods below use metric in their name.


To create a Key Result from your UI App, use the createMetric SDK method. You must pass a payload object where you set the desired properties of the new Key Result you are creating. Refer to the Create Key Result REST API endpoint for additional information about the available and required properties you must set.

const createMetricPayload = {
  id: metricId,
  ownerId: "owner-id",
  ownerIds: ["owner-id"],
  goalId: "goal-id",
  manualType: "double",
  targetOperator: "at_least",
  initialValue: 1,
  target: 12,
  critical: null,
  name: "test",
  dueDate: "0001-01-01T00:00:00Z",
  softDueDate: "0001-01-01T00:00:00Z",
  links: {},
  customFields: {},
  format: { prefix: "", suffix: "", fractionSize: 0 },
  insightName: "",
  actual: 1,
  .then((metric) => console.log(metric));


To get a Key Result use the getMetric method and pass the KR Id. For example:

const metricId = "metric-id";

  .then((metric) => console.log(metric));


To get the Key Results under a specified Objective, use the getGoal method first, passing the desired Objective Id. The KRs under that objective are available in the metrics object of the response, so you can say something like:

const goalId = "goal-id";

  .then((goal) => console.log(goal.metrics));


To update an existing Key Result, use the updateMetric method and pass a payload object containing the properties you must update.

const updateMetricPayload = { id: "some-test-metric-id", name: "my-new-metric-name"};

  .then((metric) => console.log(metric));

NOTE When you are updating a Key Result You must always pass an id property in your payload and set its value to the Id of the Key Result you are updating.


To delete a Key Result, use the deleteMetric method and pass the desired key Result Id. For example:

const metricId = "some-test-metric-id";



To post a Key Result update (programatically referred to as checkin) use the checkinMetric UI Apps SDK method. You must pass the Id of the KR you wish to update, as well as construct a payload with the following required properties:

  • checkInDate - the date of this KR update
  • actual - the updated Key Result value
  • comment - add any text you want to add as KR update note.

For example:

const metricId = "some-metric-id";
  const checkin = {
    checkInDate: new Date().toISOString(),
    actual: 10,
    comment: "A comment for this specific checkin",
sdk.checkinMetric({ id: metricId, checkin }).then((newCheckin) => console.log(newCheckin));


To post a Key Result update with an emoji, where emoji and name properties should be a valid emoji codes. The targetId is the id of the metric update message. The targetType is always "checkin".

  createReaction: {
    "emoji": "😙",
    "name": "kissing-face-with-smiling-eyes",
    "targetId": "targetId",
    "targetType": "checkin"
  isReactionOnGif: false
}).then(response => console.log(response));


The reactionName should be a valid emoji name. The targetId is the id of the metric update message.

  "reactionName": "kissing-face-with-smiling-eyes",
  "targetId": "targetId",  
}).then(response => console.log(response));


To delete a metric update snapshot.

  metricId: "metricId",
  snapshotId: "snapshotId"
}).then(response => console.log(response));


To update metric snapshot message and image. Every property is mandatory.

    metricHistoryId: "metricHistoryId",
    comment: {
      comment: "Metric snapshot message",
      gif: {
        id: "id",
        url: ""
}).then(response => console.log(response));


To receive metric update event.

sdk.onMetricUpdated((event) => {