How to Fix MALFORMED_ID Error

How to Fix MALFORMED_ID Error

Last Updated on April 25, 2022 by Rakesh Gupta

I want to thank, each reader, and follower of, for their support and feedback(s). Some of you requested me to write a blog post to explain (1) MALFORMED_ID Error; and, (2) how to solve it. 

I have and will continue to, try my best to incorporate suggested topics, from readers and followers of my blog, in my upcoming articles.

Big Idea or Enduring Question:

  • How do you resolve the MALFORMED_ID error? 

The Record-Triggered Flow is a way of automating business processes. Record-Triggered Flow is a powerful tool for system administrators and developers to implement business processes without writing code. However, with great power comes great responsibility –  If a user starts creating a new flow for each requirement – or creating flows without understanding Salesforce limitations – then, a user may encounter many issues, either in the future or, while the testing/deployment phase.

In my last post How to fix FIELD_INTEGRITY_EXCEPTION Error, I discussed how to solve the FIELD_INTEGRITY_EXCEPTION error by passing the correct record ID to the flow data element. 

This article goes one step further; it explains another common error   MALFORMED_ID Error. The article will help you to understand the following items:  

  1. Why errors could occur
  2. How to identify errors by reading system-generated flow error email
  3. How to solve the problem.

Business Use case

Tamara McCleary is working as a System Administrator at Gurukul on Cloud (GoC). GoC implemented Account Management a few years ago in Salesforce. Serdula has a requirement from her manager that, as soon as a Contact gets created, without assigning it to an account, then auto-assign such Contacts to a global account ‘Customers with no account’‘. 

Global account’ named ‘Customers with no account? What is that?

Well, in this case, a ‘global account’ is nothing but a ‘holding place’ for unassigned contacts – i.e., contacts, that, when created, could not, or did not, get assigned to an account. 

For instance, suppose a user creates a contact named John Smith; but, at this point, the User is not sure to which account John Smith belongs.

Leaving the Account field blank, while creating a contact, may create a data integrity issue(s). Therefore, it would behoove a User to collect all unassigned contacts in one central place – in our case, that would be a global account named ‘Customers with no account’ account.

Let us continue with our aforementioned John Smith use case.  Now, suppose, that few months later, the User learns that John Smith works for Acme Corporation, and therefore, he belongs to Acme Corporation Account.

So, in a situation(s) like this, to maintain data integrity, when creating a John Smith contact, the User can assign John Smith to ‘Customers with no accounts’ ‘holding’ account. And then, as soon as the User finds out that John Smith belongs to Acme Corporation, the User can click on the Contact Tab, look for John Smith, and then, update John Smith’s Account from ‘Customers with no account’ to Acme Corporation.

What is MALFORMED_ID Error?  

A user mostly encounters a MALFORMED_ID error when he/she populates(1) a lookup field, ID with invalid characters; or (2) populates an ID with a length less than 15 characters

For example, while updating a contact via After-save flow on contact if, in the place of AccountId, a user passes a 14-digit ID of an account record or ABC in place of account ID, then, the user will encounter a MALFORMED_ID error.

In the end, Tamara’s Flow will look like the following screenshot:

Once everything looks good, perform the steps below: 

  1. Click Save.
  2. Enter Flow Label the API Name will auto-populate.
  3. Click Show Advanced.
  4. API Version for Running the Flow: 55
  5. Interview Label: Generate Malformed Id Error {!$Flow.CurrentDateTime}
  6. Click Save

Almost there! Once everything looks good, click the Activate button.

Proof of Concept

  1. Create a contact record with no account associated with it.

Once you’re done, click on the Save button. Boooommmm, you encounter the MALFORMED_ID error, as shown in the following screenshot:
👉   As mentioned earlier, the reason behind the error is, we are updating
Contact record’s AccountId field with invalid record Id – in the current scenario, with a abc instead of a 15 digit record ID.

If you see MALFORMED_ID errors, it means that the field is expecting a valid Salesforce ID. A valid Salesforce ID means that an ID that meets ID field’s requirements, to resolve MALFORMED_ID error.


To fix the MALFORMED_ID error in a Flow, you must pass the correct Id for a lookup field. The best way is to get the account Id by querying the record and the map. 

Proof of Concept

  1. Create a contact record with no account associated with it.
  2. Once you are done, click on the Save button. 
  3. Notice that, Contact is created and assigned to the Global account (Customers with no account) record by the Flow.

Formative Assessment:

I want to hear from you!

What is one thing you learned from this post? How do you envision applying this new knowledge in the real world? Feel free to share in the comments below.

Have feedback, suggestions for posts, or need more information about Salesforce online training offered by me? Say hello, and leave a message!

One thought on “How to Fix MALFORMED_ID Error

  1. Nice tip.
    I had a problem on the Process Criteria, where I was picking [Contact].Account.Id instead of [Contact].AccountId (without the dot ‘.’). Once I changed it, it worked.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.