All I see is dead space. 😞
Search
6 results for “asynchronaut”
-
And let this also be a reminder that a wondrous technology called #email exists that allows you communicate asynchronously.
-
Modest-IoT-Nano-Framework (2.0.0) for esp32 by Angel Velasquez
➡️ https://github.com/modest-iot/modest-iot-nano-framework
An event-driven, asynchronous IoT framework for ESP32, approved by Arduino and available in the Arduino Library Manager.
-
Are Your HTTP Callouts and Outbound Messages on an Async Path?
This post is item 16 in my Salesforce Flow Best Practices series. The rule is short: when your flow talks to another system, it should do so after the main transaction has committed. Salesforce enforces this for HTTP callouts in record-triggered flows by requiring the Run Asynchronously path. Outbound messages belong on the same path. In schedule-triggered flows there is no async path, so a Wait element plays a similar role.
In this post I’ll explain why the rule exists, then walk through three builds I see often on client projects: an ERP order sync, an outbound message to middleware, and a nightly credit check. Each one shows where the integration step should sit and what breaks when it doesn’t.
Why Integration Messaging Needs an Async Path
A record-triggered flow on the default path runs inside the same transaction as the record save. That transaction holds uncommitted work: the record itself, plus any updates other automation made along the way. Salesforce won’t let you make a callout while that work is pending. If you try, you get the familiar error:
System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out.The restriction protects you from three problems:
- Phantom data in the other system: If the callout succeeds but the save later fails a validation rule or hits a limit, the external system has a record that Salesforce rolled back.
- Slow saves: A callout can wait up to 120 seconds for a response. On the immediate path, your user stares at a spinning Save button the whole time, and a data load slows to a crawl.
- Locked records: A long transaction holds record locks longer, which raises the odds of
UNABLE_TO_LOCK_ROWerrors elsewhere.
The Run Asynchronously path solves all three. It runs after the triggering record is committed, in its own transaction, much like an Apex
@futuremethod. Flow Builder enforces this for HTTP Callout actions: if you drop one on the immediate path, the builder tells you to move it to an asynchronous path.Outbound messages are a little different, because Salesforce queues them and delivers them in the background. Even so, I put them on the async path too. It keeps all integration steps in one predictable place, and it makes the flow easier to read for the next admin.
Example 1: Send a Closed Won Opportunity to the ERP
A distribution company I worked with wanted every Closed Won opportunity to create a sales order in their ERP. The ERP returns an order number, which sales reps need to see on the opportunity. Here is how to build it.Step 1: Set Up the Connection
Create an External Credential and a Named Credential for the ERP endpoint. Grant access to the External Credential’s principal through a permission set assigned to the user the async path runs as. Then create the HTTP Callout action from Flow Builder: choose the Named Credential, set the method to POST, the path to
/orders, and paste a sample request and response so Flow knows the data structure.Step 2: Configure the Start Element
Create a record-triggered flow on Opportunity, triggered when a record is updated. Set the entry condition to
StageName Equals Closed Wonand choose “Only when a record is updated to meet the condition requirements.” Optimize the flow for Actions and Related Records, then check Include a Run Asynchronously path to access an external system after the original transaction for the triggering record is successfully committed.Step 3: Build the Async Path
You now have two paths below Start. Leave the immediate path for work that must happen in the save, such as stamping a Closed Won Date. On the Run Asynchronously path, add:
- An Assignment that maps
$Recordfields (Account number, amount, close date, line items from a Get Records) into the request body variable. - The HTTP Callout action, passing in the body.
- A Decision on the response code: 200 or 201 goes one way, anything else goes the other.
- On success, an Update Records element that writes the ERP order number to
$Record.ERP_Order_Number__c.
Step 4: Test the Async Callout in a Sandbox
Activate the flow in a sandbox and close a test opportunity. Because the async path runs in the background, the order number won’t appear the instant you click Save. Refresh after a few seconds. If nothing appears, check the fault email for the async run.
One detail people miss: the update in step 3.4 is a new save on the Opportunity. If your entry condition were “every time a record is updated and meets the condition,” that save would launch the flow again and call the ERP a second time. The “only when updated to meet the condition” setting prevents this issue.
Example 2: Notify Middleware With an Outbound Message
A support team escalates high-priority cases to an engineering team that works in a separate ticketing tool. Their middleware (MuleSoft, Workato, Boomi, or similar) listens for SOAP outbound messages from Salesforce and creates the ticket.Step 1: Create the Outbound Message
In Setup, go to Outbound Messages and create one on the Case object. Enter the middleware’s endpoint URL, pick the user to send as, and select only the fields the ticket needs: Case Number, Subject, Priority, Account Name, and Description. Fewer fields means a smaller payload and less data leaving the org.
Step 2: Build the Flow
Create a record-triggered flow on Case, triggered on create or update. Set the entry condition to
Priority Equals HighANDStatus Equals Escalated, and run it only when a record is updated to meet the conditions. Turn on the Run Asynchronously path, the same way as in Example 1.Step 3: Add the Action
On the async path, add an Action element, search for the outbound message by name, and set the Record ID to
$Record.Id. Nothing else is needed. On the immediate path, you can keep any same-record field updates, such as setting an Escalated Date.Step 4: Monitor Outbound Message Delivery Status
Outbound message delivery happens in its own queue. Salesforce retries failed deliveries for up to 24 hours, and you can watch pending and failed messages in Setup under Outbound Messages > View Message Delivery Status. Make sure your middleware returns an acknowledgment, or Salesforce will keep retrying.
This pattern takes only a few minutes to build, and it keeps the escalation process reliable. The flow decides when a case qualifies, and the outbound message carries only the fields the ticket needs. Salesforce handles delivery and retries in the background, so agents never wait on the middleware.
Example 3: Nightly Credit Check in a Schedule-Triggered Flow
Schedule-triggered flows don’t have a Run Asynchronously path. They also run as batches of interviews in one transaction, so a callout often fails with the same uncommitted-work error, even when the flow has no DML before the callout. Salesforce’s guidance is that a schedule-triggered flow can make callouts only after it executes a pause. In today’s Flow Builder, that pause is a Wait element. When an interview reaches a Wait, Salesforce commits the transaction and resumes the interview later in a fresh one, where the callout is allowed.
Here’s a real case. A finance team flags new business accounts with Credit_Check_Needed__c = true. Every night, a flow calls a credit bureau API and writes back the score.Step 1: Configure the Start Element
Create a schedule-triggered flow that runs daily at 1:00 AM. Set the object to Account and the condition to
Credit_Check_Needed__c Equals True. Don’t start with a get or loop; the flow already runs once per matching record (see item 4 of this series).Step 2: Add the Wait
Add a Wait for Amount of Time element directly after Start. Use a short duration, such as one minute. Its only job is to commit the transaction and push the rest of the interview into a new one.
Step 3: Make the Callout
After the Wait, add the HTTP Callout action for the credit bureau, passing
$Record.Name, the tax ID field, and the billing address.Step 4: Write Back the Result
Add a Decision on the response code. On success, update
$Recordwith the score and setCredit_Check_Needed__cto false. The next night’s run will skip it.Two things to keep in mind. First, waiting interviews resume in batches, so a large record set still finishes over time rather than all at once. Second, keep the steps after the Wait lean. Anything you put before the Wait shares a transaction with every other interview in the batch.
Can You Update Records After the Callout?
Yes. Order is what matters. Salesforce blocks a callout while uncommitted work is pending, but it allows DML after a callout returns.
- Callout, then update: works. This is how Example 1 writes the ERP order number back.
- Update, then callout: fails with the uncommitted work error and goes to the fault path.
- Callout, update, callout: the second callout fails. Watch for this inside loops. Make all callouts first, collect the results, then update once at the end.
- Outbound messages: order doesn’t matter, because the action only queues the message.
Should You Add a Fault Path to the Callout or Outbound Message?
Yes for HTTP callouts, and it’s cheap insurance for outbound messages. Just be clear on what each one catches.
HTTP Callout action: The fault path runs when the call itself fails: a timeout, a connection error, a bad endpoint, or a Named Credential or permission problem. A 4xx or 5xx answer from the server usually comes back as a response code instead of a fault. So you need both: a Decision on the response code for errors the server returns, and a fault path for calls that never complete.
Outbound message action: The fault path only catches a failure to queue the message, such as an inactive or misconfigured outbound message. It won’t fire if the endpoint is down. Delivery failures are handled by Salesforce’s retries and show up under View Message Delivery Status.
What happens when the fault path runs: The interview doesn’t fail, so Salesforce sends no flow error email. That’s the main risk; without anything on the fault path, the error disappears. Whatever you put there is your only record of the failure.
How to Handle Flow Callout Errors
On the fault path and on the error branch of your Decision:
- Update the triggering record with a status, such as
Sync_Status__c = Failed, so users can see the problem on the page. - Create a log record (for example, an Integration Log custom object) with
$Flow.FaultMessage, the record ID, and the response code. DML here is fine because it comes after the callout. - Send a custom notification or email to the admin or integration owner.
- Optionally, have a nightly schedule-triggered flow pick up records with
Sync_Status__c = Failedand retry them after a Wait element.
Don’t make another callout on the fault path after these updates. It will fail for the same uncommitted work reason.
What About Other Flow Types?
- Screen flows: A Screen element commits the transaction, so put a screen between your data changes and the callout. Actions also offer transaction control, which lets you run a callout in a new transaction.
- Autolaunched flows called as subflows: The subflow inherits the caller’s transaction. If a record-triggered flow calls it on the immediate path, the callout still fails. Call it from the async path instead. Don’t add a Wait to the subflow; record-triggered flows don’t support pausing.
- Platform event-triggered flows: These already run in their own transaction after the event is published. They are a good fit when several systems need the same message.
Spot These Mistakes Before They Reach Production
- Updating the record and calling out on the same path: Do same-record updates on the immediate path or in a before-save flow. Keep the callout and the write-back of its response on the async path.
- Not adding a fault path: An async path has no user watching it. If the callout fails, nobody sees an error on screen. Add a fault path to every callout that logs the error to a custom object or sends an email to the admin team. See item 11, Should You Use Fault Paths?.
- Expecting instant results: The async path runs shortly after commit, not during the save. Don’t build screens or reports that assume the external ID is there the moment the user clicks Save.
- Missing permissions: The async path still needs access to the Named Credential. If it works when you debug it and fails in production, check the External Credential principal access first.
Run This Checklist on Your Next Integration Flow
- Every HTTP callout in a record-triggered flow sits on the Run Asynchronously path.
- Outbound message actions sit on the async path too.
- Schedule-triggered flows have a Wait element before any callout.
- Each callout has a Decision on the response code and a fault path.
- Entry conditions stop the write-back from triggering the flow again.
Move Your Callouts to the Async Path Today
Moving integration work to an async path is one of the simplest changes you can make to a flow, and it prevents a whole class of hard-to-trace problems. Your users save faster, your external systems only see committed data, and your failures land somewhere you can find them. If you have a pattern that works well for you, or a case where async didn’t fit, let me know in the comments.
Explore related content:
How To Use Subflows On Fault Paths
Should You Use Roll Back Records in Salesforce Screen Flows?
Agentforce Agent Flow Action Best Practices
#BestPractices #SalesforceAdmin #SalesforceDeveloper #SalesforceHowTo #SalesforceTutorial -
I'm so tempted to get a VT240 terminal, which has a PDP-11–compatible T-11 microprocessor, and port UNIX V4 to it.
It would be wild. It has 96 KiB of ROM, 32 KiB of DRAM, an 8085 coprocessor for character processing, and no MMU.
Filesystem: I'd need to implement a filesystem resident in ROM with RAM mounts. Especially useful would be to implement copy-on-write with RAM overlays. I could reduce RAM by making exec reuse the code sections resident in ROM.
Drivers: I'd disassemble the VT240 firmware routines for interfacing with the 8085 character processor and wrap that as a driver. The keyboard already interfaces with the T-11 over serial, so one of the asynchronous serial drivers could be easily adapted. It could interface with a host over RS-232 via DB-25 and a printer via DE-9.
Crazy: Since the printer interface is bidirectional, it could be repurposed as a second serial line. The VT240 could then be connected to two other terminals or computers. What if I setup a ring of VT240s, each connected to the terminals on its left and right? I have three compatible monitors now (two monochrome VR201s and one color VR241) and just need three VT240s.
This will be a fun project after I port UNIX V4 to my soon-PDP-11/03. I'll be making a Mini-UNIX and LSX (LSI-UNIX) hybrid, rebased from V6 onto V4, which I can then build onto for this.
-
Бессмертное TCP-соединение: разрабатываем сеансовый протокол L5, который переживает смену IP и обрывы связи
Знакомая каждому ситуация: вы льёте дамп базы по SSH, держите долгую сессию с удалённым сервером или едете в поезде с нестабильным интернетом. Телефон перепрыгнул с Wi-Fi на LTE, провайдер перезапустил NAT-таблицу, или вы на пару минут заехали в длинный тоннель. Связь в итоге вернулась, но приложение уже поймало Connection reset by peer или ETIMEDOUT . Прогресс сброшен, SSH повис, передачу файла приходится начинать заново. Сам по себе TCP вовсе не такой хрупкий, как принято думать: кратковременное пропадание пакетов на полсекунды он спокойно переживает за счёт ретрансмитов, а стандартные таймауты повторных попыток в ОС измеряются минутами. Настоящая катастрофа наступает в другой момент — когда у клиента меняется IP-адрес, на домашнем роутере или операторском CGNAT протухает NAT-маппинг, либо блэкаут затягивается дольше, чем живёт состояние на промежуточном файрволе. Классический стек TCP/IP намертво привязывает соединение к четвёрке (IP_src, Port_src, IP_dst, Port_dst) . Стоит измениться хотя бы одному параметру — и для ядра операционной системы соединения больше не существует. Пакет со старого маршрута упрётся в стену, а прилетевший с нового адреса — в сухой RST . Чтобы не переписывать логику реконнектов в каждом новом проекте, я спроектировал APTCP (Asynchronous Persistent TCP) — открытый сеансовый протокол поверх обычного TCP, который превращает рвущиеся физические соединения в одну непрерывную «трубу». Сначала я обкатал математику и конечный автомат на Python в прототипе aioptcp , а затем перенёс и довёл до ума реализацию на Go — библиотеку ptcp_go . APTCP не пытается заменить WireGuard или конкурировать с QUIC по части мультиплексирования потоков. Это компактная спецификация сеансового уровня L5 (Apache 2.0) и прикладная библиотека на Go и Python, которая прячет переподключения и смену IP внутри обычного потокового сокета — как для вызовов Send / Recv или Read / Write в коде, так и для проброса отдельного TCP-потока.
https://habr.com/ru/articles/1114406/
#сети #open_source #go #concurrency #протокол #tcp #tls #golang #aptcp #реконнект