Auto ID generation for Opportunity Record

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Fatima
    Junior Member
    • Feb 2026
    • 1

    #1

    Auto ID generation for Opportunity Record

    Hi,

    I’d like every new Opportunity record to automatically generate a custom ID in the following format:

    OurCompanyName_DateCreated_AutoNumber
    Example: MZ_20260212_43

    So far, I’ve added an Auto-Increment field, which successfully generates the numeric part (e.g. 43). However, I’m unable to include the company prefix (MZ) and the Opportunity creation date in the same field.

    Is there a way to concatenate text + date + auto-increment into one field in ESPO?

    Would this require setting up a Workflow, or is there a cleaner/native way to achieve this?

    Any guidance would be appreciated.
  • heint
    Member
    • Jun 2025
    • 68

    #2
    Greetings, Fatima,

    You can add code below to paste your custom text and date in needed format:

    Code:
    $companyPrefix = 'MZ';
    $date = datetime\format(datetime\now(),null, 'YYYYMMDD');
    
    ifThen(entity\isNew(),
    cCustomId = string\concatenate(
    $companyPrefix,
    '_',
    $date
    );
    );

    cCustomId - name of your custom field.

    Just add incrementNumber part to the "string\concatenate" function​ to get all the ID

    Comment

    • heint
      Member
      • Jun 2025
      • 68

      #3
      Additional question just out of curiosity. How exactly do you implement "an Auto-Increment field, which successfully generates the numeric part"?

      Comment

      Working...