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

Community site session details

Session Id : vlG5q1l9+uMgkwPEnN3nCr
Power Apps - Microsoft Dataverse
Answered

auto assign prefix

Like (0) ShareShare
ReportReport
Posted on 10 Nov 2023 12:05:37 by 124

I want to assign a prefix to a form when they select a specific lookup option. eg- report is for School A so A will be a prefix, if its School B, B will be the prefix. The prefix can be stored in the same table with the School type. Any solutions will be helpful

I have the same question (0)
  • Sean9 Profile Picture
    124 on 14 Nov 2023 at 10:44:25
    Re: auto assign prefix

    Thank you @EricRegnier just solved it i was calling the whole table in the formula instead of the lookup and then the specific column for the prefix 🙂

  • Verified answer
    EricRegnier Profile Picture
    8,714 Most Valuable Professional on 14 Nov 2023 at 10:32:40
    Re: auto assign prefix

    If you hover over the error, what does it say? I tried on the account table and looks good from my side. Note: "Primary Contact" is a contact lookup and "Full Name" is a text column on the contact.

    EricRegnier_0-1699957880965.png

     

  • Sean9 Profile Picture
    124 on 14 Nov 2023 at 10:23:28
    Re: auto assign prefix

    hi @EricRegnier , thank you for replying, so i have been trying this like this: 

    so below calls the prefix and then the ID. The lookup column is called name in the table TAuditType. This formula keeps showing errors. Any idead?

    Sean9_0-1699957322625.png

     

  • EricRegnier Profile Picture
    8,714 Most Valuable Professional on 14 Nov 2023 at 10:13:15
    Re: auto assign prefix

    @Sean9, cheers for clarifying. You can still achieve with formula columns, but you'll need to create an autonumber column with no prefix then in your formula column reference the value of that autonumber column, and done!

  • Sean9 Profile Picture
    124 on 14 Nov 2023 at 10:08:08
    Re: auto assign prefix

    Hi @dpoggemann , could i do this via a concat formula where i call a table and its column where the prefix is stored relating to the lookup and then put the autonumber in the currect table next to it?

  • Drew Poggemann Profile Picture
    9,278 Most Valuable Professional on 13 Nov 2023 at 16:27:48
    Re: auto assign prefix

    Hi @Sean9 ,

    I would do the following, hopefully it makes sense...

    1. Setup standard autonumbering column that would not have a prefix.
    2. Setup another text field that you can populate with a real-time workflow that concatenates a prefix (based on your A / B logic) and then the autonumber field on the backend.  You can set this up if the field changes that might affect the value.  
  • ivan_apps Profile Picture
    2,187 Moderator on 13 Nov 2023 at 15:23:27
    Re: auto assign prefix

    I wish this was possible but the OOTB autonumber doesn't support dynamic prefixes.  You would need a custom auto-numbering system created where you could define the prefix per choice value. I've done it in the past, the sequential numbering is tricky since you have to lock the table during the assignment of the sequential number, but if you add a random set of characters it's a bit easier.

  • Sean9 Profile Picture
    124 on 13 Nov 2023 at 09:29:22
    Re: auto assign prefix

    sorry, i meant prefix for the autonumber so users would select school A and then it would be A-1000 as the autonumber

  • EricRegnier Profile Picture
    8,714 Most Valuable Professional on 10 Nov 2023 at 12:26:18
    Re: auto assign prefix

    Hi @Sean9

    You easily achieve this with formula columns. So the expression would be something like this. 
    Note: replace "Primary Contact" with the School lookup and navigate to the desired type, and replace "Account Name" with the remaining part.

    EricRegnier_0-1699619084710.png

     

    Here's more info: https://learn.microsoft.com/power-apps/maker/data-platform/formula-columns

    Hope this helps!

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…

MS.Ragavendar – Community Spotlight

We are honored to recognize Ragavendar Swaminatha Subramanian as our September…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 982 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 396 Super User 2025 Season 2

#3
Power Apps 1919 Profile Picture

Power Apps 1919 356

Last 30 days Overall leaderboard

Featured topics

Loading started