web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Autonumbering for Custom Entity

(1) ShareShare
ReportReport
Posted on by 68

Hello everyone,

I'm working on a custom entity in Dynamics 365 Sales that has a 1:N relationship with the Opportunity entity. I want to generate an autonumber for this custom entity, which includes the following:

  • A prefix (e.g., "ENT-").
  • A sequential number (e.g., "0001", "0002").
  • The Opportunity ID (or number) associated with the custom entity.

The autonumber should look something like this:
ENT-OPP12345-0001

I know how to create a standard autonumber with a prefix and a sequence, but is there a way to include the Opportunity ID as part of the autonumber directly? I would like to automate this process without manual intervention, ideally using built-in Dynamics features with no automations or coding.

Any advice, workarounds, or best practices would be greatly appreciated!

Thank you in advance for your help!

I have the same question (0)
  • Verified answer
    Amit Katariya007 Profile Picture
    10,409 Super User 2025 Season 2 on at
    Hello User,
     
    Please check out this article which will provide more details for OOB auto number.
     
    But Dynamics 365 Sales provides the autonumbering feature, but it doesn’t natively support including related entity data (like the Opportunity ID) directly in the autonumber format. However, here are a couple of approaches you could consider:
     
    Option 1: Combine Autonumber and Workflow/Power Automate
     
    While autonumbering can be used to generate a prefix and sequential number, you could automate appending the Opportunity ID using a workflow or Power Automate flow to update the custom entity record once it is created. Here’s how you can do this:
     
    1. Create a standard autonumber field for your custom entity with the desired prefix and sequence (e.g., ENT-0001, ENT-0002).
     
    2. Use Power Automate to update the autonumber field after the record is created:
     
    Trigger the flow when a custom entity record is created.
     
    Retrieve the related Opportunity ID from the 1:N relationship.
     
    Concatenate the Opportunity ID to the autonumber field (e.g., ENT-OPP12345-0001).
     
    Update the custom entity record with the modified autonumber format.
     
    This approach allows for automation with minimal intervention, but it does require the Power Automate flow to handle the opportunity ID.
     
    Option 2: Custom Plugin (Code-Based)
     
    If you’re open to coding, you can create a plugin that fires on the creation of the custom entity. The plugin can:
     
    1. Generate the sequential number.
    2. Retrieve the Opportunity ID from the related entity.
    3. Concatenate these parts and update the autonumber field.
     
    This approach is more seamless but involves writing code and deploying a plugin, which may not meet your preference for no automations or coding.
     
    Option 3: Manual Opportunity ID Reference
     
    If including the Opportunity ID in the autonumber isn’t a hard requirement, you can still link the custom entity to the Opportunity via the lookup field, which may simplify things.
     
    In conclusion, Power Automate is your best bet for automating this process without coding while combining autonumber fields with related entity data like the Opportunity ID.
     
    Thank you,
    Amit Katariya
     
     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 73 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 43 Most Valuable Professional

#3
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans