Customer & Sales package

Salesforce opportunity discount approval

A Salesforce Flow submits an opportunity discount; tiers decide the approvers, the sales manager then finance approve, and the status goes back to Salesforce.

Connects to Salesforce

OfficialHeadless / APIIntermediate~25 min setupv1.0.0

About this package

What it does

Salesforce opportunity discount approval gives your deal desk a clear, tiered approval without building approval processes in Salesforce. When a rep sets a discount and submits it, a record-triggered Flow (or a platform event subscriber) posts the Opportunity Id and the owner's email to the workflow.

The workflow reads the opportunity over the REST API (amount, stage, close date, term and the Discount_Percent__c / Discount_Approval_Status__c custom fields) and runs a SOQL query for its OpportunityLineItem records to see every product's list price, sales price and line discount. The Discount tiers decision table decides whether the discount is within the rep's authority, needs the sales manager or needs the sales manager and finance.

The sales manager's task has a Justification lookup from the Discount reason codes table, which fills in the normal ceiling and the evidence expected, and Approve / Reject buttons. Finance then confirms the approved discount for Tier 2 and Tier 3. The decision is written to the opportunity with PATCH (status, approved discount and notes) and the owner is emailed.

Headless / API

Starts from Salesforce: a record-triggered Flow on Opportunity (Discount_Approval_Status__c set to Submitted) calls the workflow webhook with the Opportunity Id and owner email.

Another system starts it over REST or an inbound webhook. No UI is needed; people only appear where a decision needs a human.

The flow

Step by step

  1. 1

    Discount submitted

    A Salesforce Flow posts the Opportunity Id and owner email when a rep submits a discount.

  2. 2

    Read the deal

    GET /sobjects/Opportunity/{id} and a SOQL query on OpportunityLineItem give the amount, term and every product line.

  3. 3

    Pick the tier

    The Discount tiers table decides: within rep authority, sales manager, or sales manager and finance.

  4. 4

    Sales manager approves

    The manager picks a justification (its ceiling and evidence fill in), sets the approved discount and approves or rejects.

  5. 5

    Finance confirms

    Tier 2 and 3 discounts go to finance with the manager's decision and notes.

  6. 6

    Update Salesforce

    PATCH /sobjects/Opportunity/{id} sets Discount_Approval_Status__c and the approved discount; the owner is emailed.

Salesforce discount approval — A Salesforce Flow posts the Opportunity Id when a rep submits a discount; the opportunity and its products are read, the Discount tiers table decides who approves, the sales manager and then finance approve or reject, and the status is written back to the opportunity. The same canvas you get in the designer after installing.

Forms

Inputs and task forms

The inputs a caller passes when it starts a run, and the forms people complete when the process needs a decision.

Start inputs

Salesforce discount approval

Passed by the calling system

Opportunity Id * opportunity_id · textThe 18-character Opportunity Id ({!$Record.Id} in the Flow)
Owner email * owner_email · emailname@company.comOpportunity owner's email ({!$Record.Owner.Email}): gets the decision
Account account_name · textOptional: account name ({!$Record.Account.Name}), for the task title and logs
Submitted by submitted_by_name · textOptional: who submitted the discount in Salesforce

User Task

Sales manager approval

Approve {{discount}}% discount: {{opportunity_name}} ({{currency}} {{amount}}) · 2-column grid · own header and theme

Justification * reason_code · lookup
Normal ceiling (%) reason_ceiling · number0
Evidence expected evidence_expected · text
Approved discount (%) * approved_discount · numberPrefilled: {{discount}}
I have checked the evidence on the opportunity evidence_checked · boolean
Notes * notes · textarea
ApproveReject

User Task

Finance approval

Finance: {{mgr.discount}}% discount on {{opportunity_name}} · 2-column grid · own header and theme

Approved discount (%) * approved_discount · numberPrefilled: {{mgr.discount}}
Gross margin stays above the floor margin_ok · boolean
Revenue recognition rev_rec · choice
RatablePoint in timeMixed
Notes * notes · textarea
ApproveReject

Headless

Call it from your systems

Every workflow can be started over REST, MCP or the CLI, whatever its trigger, with the sample input below. Runs start straight away on the published version; replace <workflow id> with the id the install created.

REST

shell
curl -X POST "$USERTASKS_URL/api/v1/workflows/start" \
  -H "Authorization: Bearer $USERTASKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"workflow_id":"<workflow id>","variables":{"opportunity_id":"0065g00000XyZ12AAB","owner_email":"sam.rivera@example.com","account_name":"Northwind Traders","submitted_by_name":"Sam Rivera"}}'

CLI

shell
usertasks workflows inputs <workflow id>          # the start form: keys, types, required
usertasks workflows run <workflow id> --input opportunity_id=0065g00000XyZ12AAB --input owner_email=sam.rivera@example.com --input account_name="Northwind Traders" --input submitted_by_name="Sam Rivera" --wait

Inbound webhook

shell
usertasks webhooks create <workflow id>          # prints the hook slug and secret once
curl -X POST "$USERTASKS_URL/api/webhooks/inbound?hook=<slug>" \
  -H "Authorization: Bearer <webhook secret>" -H "Content-Type: application/json" \
  -d '{"opportunity_id":"0065g00000XyZ12AAB","owner_email":"sam.rivera@example.com","account_name":"Northwind Traders","submitted_by_name":"Sam Rivera"}'

What's included

9 assets, ready to adapt

TypeNameDetails
Email templateDiscount approvedSent to the opportunity owner when the discount is approved.
Email templateDiscount not approvedSent to the opportunity owner when the sales manager or finance rejects the discount.
Data tableDiscount reason codesWhy a discount is justified, with the most each reason normally supports. The sales manager picks one in the approval form; its guidance and ceiling fill in.
IntegrationSalesforceSalesforce REST API (/services/data/v61.0). Use an OAuth access token from a connected app (client credentials or JWT bearer flow) for an integration user that can read opportunities and edit the discount approval fields.
API referenceGet opportunityGET /sobjects/Opportunity/{{opportunity_id}} — Read the opportunity (GET /sobjects/Opportunity/{id}): name, amount, stage, close date, owner and the custom discount fields.
API referenceQuery opportunity productsGET /query — SOQL query for the opportunity's products (GET /query?q=SELECT ... FROM OpportunityLineItem WHERE OpportunityId = ...): records, totalSize and done.
API referenceUpdate discount approvalPATCH /sobjects/Opportunity/{{opportunity_id}} — Write the decision to the opportunity (PATCH /sobjects/Opportunity/{id}): Discount_Approval_Status__c, the approved discount and approver notes. Salesforce answers 204 No Content.
Decision tableDiscount tiers5 rules — Who approves a discount, by the discount percent and the deal amount. First matching rule wins.
WorkflowSalesforce discount approval28 steps — A Salesforce Flow posts the Opportunity Id when a rep submits a discount; the opportunity and its products are read, the Discount tiers table decides who approves, the sales manager and then finance approve or reject, and the status is written back to the opportunity.

Discount reason codes · 5 sample rows

CodeReasonNormal ceiling (%)Evidence expectedNote for finance

Requirements

What you connect it to

Credentials never travel in a package. The install wizard asks for what your environment must provide, or installs it incomplete until you finish setup.

Needs

  • REST API — A REST API integration: set its base URL and credentials on install.
  • Inbound webhook — An inbound webhook created for the workflow, so other systems can start it.
  • Assignees — People in your workspace to receive the User Tasks (picked on install).
  • Email — Email delivery configured for the instance (EMAIL_PROVIDER), used for notifications.

After installing

  1. Salesforce integration: base URL https://<my-domain>.my.salesforce.com/services/data/v61.0 and an OAuth access token from a connected app (client credentials flow for an integration user).
  2. Create (or rename in the references) the custom fields on Opportunity: Discount_Percent__c (percent), Discount_Approval_Status__c (picklist: Draft, Submitted, Pending, Approved, Rejected), Discount_Reason__c, Contract_Term_Months__c, Approved_Discount_Percent__c and Discount_Approval_Notes__c.
  3. Assignees: pick the sales manager and the finance approver.
  4. In Salesforce, add a record-triggered Flow on Opportunity (status changes to Submitted) with an HTTP Callout or outbound message that posts {"opportunity_id", "owner_email", "account_name"} to the workflow webhook.
  5. Edit the Discount tiers thresholds and the Discount reason codes to your pricing policy; configure EMAIL_PROVIDER for the owner emails.

Asked for on install

  • Integration “Salesforce”Required

    • Tokenconfig.auth_config.token
    • Base urlconfig.base_urldefault https://acme.my.salesforce.example.com/services/data/v61.0· optional
  • Workflow “Salesforce discount approval” assigneesRequired

    • User for step “Sales manager approval”nodes.9.config.assignee_id
    • User for step “Finance approval”nodes.12.config.assignee_id

Install

Install it in your workspace

Works on UserTasks cloud and on any self-hosted instance. Installing creates the assets above; nothing runs until you complete setup and start it.

In the app

  1. Download salesforce-discount-approval-1.0.0.utpkg.
  2. Open Automations → Packages and drag the file onto the page (or choose Import package). Browse gallery there lists every gallery package without downloading by hand.
  3. Pick the file. The wizard verifies the checksum, every file hash and the signature, and shows the readme.
  4. Review the changes (what is created) and the data rows.
  5. Fill in the requirements, or tick Keep incomplete and finish later with Complete setup.
  6. Done: the workflow is published and active once setup is complete.

With the CLI

shell
curl -fLO https://usertasks.com/gallery/salesforce-discount-approval-1.0.0.utpkg
usertasks packages inspect salesforce-discount-approval-1.0.0.utpkg       # offline: checksum, hashes, signature
usertasks packages install salesforce-discount-approval-1.0.0.utpkg --dry-run
usertasks packages install salesforce-discount-approval-1.0.0.utpkg       # prompts for each requirement
usertasks packages install salesforce-discount-approval-1.0.0.utpkg --keep-incomplete --yes   # in CI; finish with:
usertasks packages complete salesforce-discount-approval -f values.yaml

Verify the download

File SHA-256
6c54851fdcfada021111965a5589b51e2c59328783bce29132bf9e22f23adabb
Package checksum (what is signed)
sha256:9b995251b2ab56edf09aabf8f9731801c5a9224d1c825332b0a5a1e8ebd58e2e
Signer
Unsigned preview build — compare the SHA-256 above

shasum -a 256 salesforce-discount-approval-1.0.0.utpkg should print the file SHA-256. How gallery packages are signed.

Versions

Version 1.0.0

  1. v1.0.02026-10-28First release.

Installing a newer version upgrades in place: local credentials and requirement values are kept, and changes you made are flagged first. How packages work

More packages

Related

Browse the whole gallery