CoSell docs Open CoSell

Connect Dynamics 365 Sales

You need a Dynamics 365 system administrator and someone who can register applications in Microsoft Entra ID. It takes about fifteen minutes.

Register the application

  1. In Microsoft Entra ID → App registrations → New registration, name it CoSell (single tenant). Note the Application (client) ID and the Directory (tenant) ID. It needs no redirect URI and no API permissions: what CoSell may do is decided by the application user's security role in step 3.
  2. Under Certificates & secrets, add a client secret and copy its value (it is shown once). Note when it expires: CoSell loses its connection that day unless you enter a new one.
  3. In the Power Platform admin centre, go to Manage → Environments, open your environment, then Settings → Users + permissions → Application users → New app user. Choose Add an app and pick the registration, select the business unit, and give it security roles that can read and write Opportunity, Account, Contact, Lead and Note (Annotation), read users and currencies, and customise the Opportunity table (CoSell creates its read-back columns). System Customizer plus Salesperson works; a narrower custom role works too. An application user takes no licence.
  4. In CoSell, Settings → CRM → Dynamics 365 Sales, enter the environment URL exactly as Power Apps shows it under Settings → Developer resources without the /api/data/… part (https://acme.crm.dynamics.com; the region part differs by data centre, crm2, crm7 and so on), the directory ID, the application ID and the secret, and press Connect Dynamics 365.

CoSell gets its tokens from Entra ID with the client credentials flow, for the scope <environment URL>/.default: no consent screen, nothing tied to a person. A token for one environment does not open another, so a sandbox and production are connected separately.

What activation does

  • Adds the read-back columns to Opportunity with the new_ prefix, which is the default publisher's: new_aceopportunityid, new_acepartnercentralurl, new_acereviewstatus, new_acereviewcomments, new_acestage, new_aceorigin, new_aceawsseller, new_aceengagementscore, new_aceinvolvementtype, new_acesyncstatus, new_acelastsyncedat, new_acesyncerror, new_aceexpectedspend, new_acemarketplaceoffers, and the new_acecosell two-option (Yes/No) column that marks an opportunity for AWS. Columns that already exist are left as they are. Dataverse publishes a new column itself, and CoSell publishes the table once more.
  • Your own prefix and solution. If your org keeps customizations under its own publisher, enter its Publisher prefix (without the underscore, such as hl) when you connect: the columns are then hl_aceopportunityid and so on. Add the Solution's unique name to have the new columns join that unmanaged solution; its publisher's prefix must be the one you entered, or Dataverse refuses the columns and the connection says why.
  • CoSell does not touch your forms or views: add the columns sellers should see (at least new_acecosell) to your Opportunity form.
  • Reads the organisation's base currency and transaction currencies, and its enabled users with Read-Write access. An opportunity's owner is matched to a CoSell user by the owner's Primary Email.

If activation reports a column as refused, the message says why; most often the application user's role may not customise Opportunity. You can also create the columns listed above by hand, with the same names, and activate again.

Stages, option sets and the AWS inputs

  • CoSell reads and writes the opportunity's Sales Stage choice column (salesstage: Qualify, Develop, Propose, Close by default), which is what you map to ACE stages under Settings → Mapping → Stages. CoSell shows the labels, not the values. It is a regular column and not the active stage of a business process flow: if your team moves opportunities along the process bar only, check that Sales Stage follows in your organisation, or map the stages from another column.
  • CoSell's standard fields are these columns: Deal name name (Topic), Amount estimatedvalue (Est. Revenue), Closing date estimatedclosedate, Next step stepname (Pipeline Phase), Account parentaccountid, Contact parentcontactid, Owner ownerid, and the currency of the opportunity as its ISO code.
  • Industry, lead status (Status Reason) and lead source are choice columns too; CoSell reads and writes their labels. Dynamics refuses a label that the column does not have, and the sync reports the refusal.
  • The default mapping reads the AWS inputs from columns named new_awsusecase, new_awsdeliverymodel, new_awsprimaryneeds, new_awssalesactivities, new_customerawsaccountid and new_competitor. Create the ones sellers fill as text columns, or map your own columns under Mapping.
  • Converting a lead uses Dynamics' own Qualify Lead: the lead becomes Qualified, with a new contact, a new account (or the existing one you chose) and a new opportunity in the lead's currency, or the organisation's base currency when the lead has none.
  • A won or lost opportunity is read-only in Dynamics until it is reopened, so CoSell cannot write AWS updates to it until then.

How changes reach CoSell

Every few minutes CoSell reads the opportunities changed since its last look. To hear about a change at once, do one of these.

A Dataverse webhook. In the Plug-in Registration tool:

  1. Register → Register New Web Hook. Endpoint URL is the URL shown in CoSell, as it is, with nothing added. Set Authentication to HttpHeader and add one property with key x-cosell-token and the webhook token shown in CoSell as its value. (HttpQueryString with key token works as well. WebhookKey does not: it sends the value under the name code, which CoSell does not read.)
  2. On the new webhook, Register New Step twice: message Create and message Update, primary entity opportunity, execution mode Asynchronous. A synchronous step makes every save in Dynamics wait for CoSell, and fail when CoSell cannot be reached.

Dynamics posts the event to CoSell over HTTPS (port 443) and expects an answer within 60 seconds; a failed delivery shows under Settings → System jobs in Dynamics, and the regular read picks the change up anyway.

A Power Automate flow on the Dataverse trigger When a row is added, modified or deleted (change type Added or Modified, table Opportunities) that posts { "opportunityid": "<the row's id>" } to the same URL with the header x-cosell-token.

Limits

Dataverse limits each user, CoSell's application user included, to about 6,000 requests in five minutes. When it answers that the limit is reached, CoSell tries again later; nothing is lost.