Skip to main content

Type Definitions

Shared Types

RevOps Functions currently utilize the following types. These interfaces are loaded into the editor automatically and are shared across all function types. Each function type will also have specific input and output types that are built on top of these.

General

type DateType = string | null;

type AgreementType =
| "new-order"
| "renewal"
| "nda"
| "one-party-nda"
| "expansion"
| "referral-agreement"
| "data-processing"
| "partnership"
| "msa"
| "cancellation"
| "misc";

interface Overview {
contractStartDate: DateType;
contractEndDate: DateType;
contractDuration: number | null;
revenueMetrics: RevenueMetrics | null;
}

interface Template {
id: string;
name: string;
}

Revenue Metrics

interface RevenueMetrics {
annualRecurringRevenue: number;
monthlyRecurringRevenue: number;
nonRecurringRevenue: number;

totalContractValue: number;
totalDiscount: number;

annualBreakdown: AnnualBreakdown[];
}

interface AnnualBreakdown {
year: number; // 1 indexed
totalContractValue: number;
}

These values can be reviewed for each card in the revenue metrics section of deal desk. For more information, review the revenue metrics documentation.

This object is null for non-priced agreements such as NDAs, MSAs, and Cancellation Forms.

Layout

interface ContentBlockItem {
id: string;
}

type BlockType =
| "pricing-table"
| "term-table"
| "rate-table"
| "term-header"
| "grand-total"
| "address-information"
| "signature"
| "attachment";

type PricingTableColumnsType =
| "product"
| "length"
| "time-period"
| "schedule"
| "quantity"
| "per-month"
| "per-year"
| "per-unit"
| "total";

type TermTablePositionType =
| "belowPricing"
| "abovePricing"
| "headerSummary"
| "attachment"
| "";

interface ContentBlock {
items: ContentBlockItem[];
columns: PricingTableColumnsType[];
type: BlockType;
position: TermTablePositionType;
}

interface Layout {
blocks: ContentBlock[];
}

Terms

type TermPropertyType =
| "money"
| "number"
| "date"
| "dropdown"
| "string"
| "email";

interface TermProperty {
name: string;
type: TermPropertyType;
value: string;
}

interface OptionTermProperty extends TermProperty {
type: "dropdown";
options: { value: string; text: string }[];
}

type TermType = TermPropertyType | "paragraph" | "contract-period" | "attachment";

type BuiltInId =
| "latePaymentPercentageFee"
| "purchaseOrderNumber"
| "daysUntilDue"
| "billingStartDate"
| "externalAccountId"
| "billingFrequency"
| "contractStartDate"
| "contractDuration"
| "automaticRenewal"
| "expirationDate";

interface Term {
id: string;
name: string;
label: string;
type: TermType;
builtInId: BuiltInId | null;
properties: (TermProperty | OptionTermProperty)[];
}

interface DateTerm extends Term {
type: "date" | "contract-period";
startDate: DateType;
endDate: DateType;
}

interface NumberTerm extends Term {
type: "money" | "number";
value: number;
}

interface ValueTerm extends Term {
type: "dropdown" | "string" | "email" | "attachment";
value: string;
}

interface OptionTerm extends ValueTerm {
type: "dropdown";
options: { value: string; text: string }[];
}

interface AttachmentTerm extends ValueTerm {
type: "attachment";
signatureRequired: boolean;
}

Line Items

type UnitPricingInterval = "month" | "year" | "one-time";

interface PricingPeriod {
unitPricingInterval: UnitPricingInterval;
quantity: number;
listPrice: number;
adjustedPrice: number;
netPrice: number;
annualPrice: number;
monthlyPrice: number;
startDate: DateType;
endDate: DateType;
periodDuration: number;
}

type LineItemPropertyType =
| "dropdown"
| "number"
| "checkbox"
| "string"
| "limit";

interface LineItemProperty {
name: string;
value: string | boolean | number;
type: LineItemPropertyType;
}

interface LineItemCheckboxProperty extends LineItemProperty {
value: boolean;
type: "checkbox";
}

interface LineItemValueProperty extends LineItemProperty {
value: string;
type: "dropdown";
}

interface LineItemNumberProperty extends LineItemProperty {
value: number;
type: "number";
}

interface LineItemLimitProperty extends LineItemProperty {
value: number;
enabled: boolean;
type: "limit";
}

interface OptionLineItemProperty extends LineItemValueProperty {
type: "dropdown";
options: { text: string; value: string }[];
}

interface LineItem {
name: string;
lineItemTitle: string;
skuId: string;
productCode: string;
pricingSchedule: PricingPeriod[];
properties: (
| LineItemProperty
| LineItemCheckboxProperty
| LineItemValueProperty
| LineItemNumberProperty
| LineItemLimitProperty
)[];
}

External Connections

interface ExternalConnection {
externalSystem: string
externalObject: string
externalId: string
}

The external system and external object field options are system dependent. Values are always lowercase.

SystemexternalSystem ValueexternalObject ValuesNotes
Salesforcesalesforceopportunity, quotequote is only available for RevOps created Quotes or deals that were created through a Quote Import
HubSpothubspotdeal
External Connection Creation and Changes

RevOps CRM sync occurs as a background job and generally runs parallel to or after functions are run. When an external ID is created by RevOps during CRM sync, it may not be available in all cases.

Most functions will not be re-run when an external ID changes.

Pre-Submit Validation

interface PreSubmitTestData {
deal: {
lineItems: LineItem[];
terms: (Term | ValueTerm | OptionTerm | NumberTerm | DateTerm)[];
template: Template;
agreementType: AgreementType;
overview: Overview;
layout: Layout;
externalConnections: ExternalConnection[];
};
}

interface PreSubmitResponseItem {
message: string;
blocking?: boolean;
enableMarkdown?: boolean;
}

type PreSubmitResponse = string | (string | PreSubmitResponseItem)[];

Custom Approval Triggers

interface ApprovalTriggerTestData {
deal: {
lineItems: LineItem[];
terms: (Term | ValueTerm | OptionTerm | NumberTerm | DateTerm)[];
template: Template;
agreementType: AgreementType;
overview: Overview;
layout: Layout;
externalConnections: ExternalConnection[];
};
}