Dynevia
IT EN
Contact

Integration7 min read

Power and gas in the CRM: status belongs to the supply point

We connected an agency network's CRM to the Salesforce systems of two national energy operators. The costliest lesson is also the simplest: a dual-fuel contract has two outcomes, and an integration that reads only one gets exactly the cases that matter wrong.

For an agency selling power and gas, a contract is a single thing: one customer, one signature, one file. For the operator it is a chain: an offer, an order and, inside the order, one line per supply, the POD for electricity and the PDR for gas, the Italian codes that identify each supply point. Each line has its own technical steps towards the grid operator and towards billing. The sales network's CRM has to follow that chain, because commissions, complaints and back-office work all depend on it. What follows comes from the integrations we built with two national energy operators, and from our work on the network's other flows.

Status lives on the order line

The first version of the integration read one record per contract, holding the status of the offer and of the order. The record did not say which supply it referred to, and on dual-fuel contracts the same status was copied to both power and gas. That worked as long as the two supplies agreed. They disagreed in the cases that matter: a POD that does not exist, a PDR registered to a different customer, a supplier switch already under way. There the order showed as in progress or partially fulfilled, and the cancelled supply still looked alive.

The real status lived on the order line, but not in the field that claimed to hold it: in the operator's interface, line status read “New” on every contract we examined, including those already activated or cancelled. The true outcome sat in another field of the line and in its technical activities, one for the process towards the grid operator and one for billing. We built an extract that returns one row per contract and supply, with the POD or PDR, line status, technical activities and the reason for any rejection. The CRM routes each row to the right supply on its own: POD to power, PDR to gas. Broadband offers come in as a third type of supply.

  • On its first production run the extract processed 3,515 rows in 48 seconds. It surfaced 46 dual-fuel contracts whose two supplies were in different states, and 26 supply points that did not match between the two systems, flagged rather than corrected.
  • Moving to per-supply status, 52 supplies lost commission eligibility: all of them cancelled by the operator, all of them counted as payable until then. No active supply changed outcome.

The conventions nobody writes down

Every system has rules that no document mentions. You find them by reading real cases, read-only, before writing any code.

  • A contract can have two orders: the original, superseded after a cooling-off withdrawal, and a cancelled twin. Read only one order per contract and you may pick the wrong one.
  • When an offer completes, the operator clears its sub-status. Our import never wrote an empty cell, so 770 contracts said “awaiting back-office confirmation” and 232 said “credit check in progress” when they were already switching or live. An empty field can mean “unknown” or “done”, and the rule has to be decided field by field.
  • The same outcome goes by different names for different users. For one sub-agency's CRM, “active” means activated and nothing else; for commissions, a fulfilled order counts too. Agree the status map with the people who read it, and write it down.
  • The extraction window has to cover the time to activation. With another operator, the back office loaded only the current month's contracts, but activation usually arrives in the second month after signature: in a three-month extract, 68% of contracts from two months earlier showed as activated, against 25% from the previous month. With a single month, status almost never reached “activated”.
  • In a monthly statement, two columns shared the same name and appeared in reverse order on one of the sheets: contracts whose commission had been clawed back showed as active. Validate headers; never take them on trust.

When in doubt, don't guess

We apply one rule to every integration: uncertain data goes to review. It is never completed by intuition.

  • A contract code found on two records is skipped as ambiguous and flagged, not assigned to the first match.
  • A supply point that differs between the two systems is flagged and never corrected automatically.
  • When submitting contracts to the second operator, a product that is not in the catalogue is never swapped for the closest one, an unsupported process never falls back to the default, and an address that cannot be resolved with certainty to the official code goes to review. The language model that helps with addresses can only choose among the candidates returned by the operator's system: it cannot invent a code.
  • Every rejection from the operator is classified by cause: the agent can fix it, the fault is ours, the operator is not responding, it is a legitimate no, or it is not yet recognised. Our own faults go to a review queue and trigger no notifications, and personal data is masked before any message is stored. Before this, a rejection lived only in the agent's screenshot, and the “submitted” event fired before the answer came back: a rejection counted as a submission.

A dual-fuel contract does not have one status. It has two, and the cases that matter are the ones where they differ.

File layouts, upkeep, reconciliation

After signature, a digital signature platform delivers one file per contract to the operator's back-office system. We updated four layouts, consumer and business for power and gas, first in the test environment and only for the test organisation, with a before-and-after comparison: no existing value was supposed to change, and none did. The client signed six test contracts and received twelve files and twelve archives without errors. Columns left empty get confirmed too: an empty column is a specification. One detail worth remembering: in testing, files landed in the same folders as production, told apart only by a code in the file name. Separating environments means separating destinations as well.

Then there are the things that break on their own. The proxy in front of the service dropped connections after 60 seconds without data, and extracting a long period took longer: the service now sends a heartbeat every 15 seconds. An OR condition between two dates switched off Salesforce's indexes; without it, the same query went from 151 seconds to one or two. And when the operator releases a new version of its APIs, our flows test it in the operator's staging environment under a dedicated version, while production stays on the previous one until release day.

Finally, the check that closes the loop: a reconciliation by contract code between the two systems. Over the first three weeks of a month, 2,428 of 2,556 contracts were in the CRM with the right agent, and none with the wrong one; 67 were missing, 34 of them already cancelled or rejected. In the other direction, 2,068 of 2,075 contracts were found at the operator. These are the numbers that tell you whether the two systems are telling the same story.

Contact

Is your process still living in a spreadsheet?

Tell us what the system has to do, what data it works with and what constraints apply. We'll come back to you with the questions that matter and a phased proposal.

Get in touch