Skip to main content
Community site session details

Community site session details

Session Id :
Power Apps - Microsoft Dataverse
Unanswered

Get a Label from Choices to tje JSON file

(0) ShareShare
ReportReport
Posted on by

Hello Guys,

 

i am building a JSON file in Power Apps app , which i would like to pass to my small automation for populating a Word Template.

 

 

Set(jsonObj, JSON({
 FirstName: Office365Users.MyProfileV2().givenName,
 LastName: Office365Users.MyProfileV2().surname,
 OrderDate: Text(DateValue(First(PatchedRecords).createdon), "yyyy-mm-dd"),
 Products: ForAll(CartItems,
 {
 ProductID: ProductID,
 Quantity: ThisRecord.Quantity,
 LicenceType: LookUp(Choices(LM_Products.LicenceType), Value = licenceType).Value,
 ProductName: LookUp(LM_Products, ProductID = CartItems[@ProductID], ProductName),
 Vendor: LookUp(LM_Products, ProductID = CartItems[@ProductID], Vendor),
 OrderedUnitPrice: LookUp(LM_Products, ProductID = CartItems[@ProductID], ProductPrice),
 EndOfLicence: LookUp(LM_Products, ProductID = CartItems[@ProductID], EndOfLicence),
 ProductPrice: LookUp(LM_Products, ProductID = CartItems[@ProductID], ProductPrice),
 TotalPrice: Quantity * LookUp(LM_Products, ProductID = CartItems[@ProductID], ProductPrice)
 }
 )
}, JSONFormat.IndentFour))

 

 

How can i get the Label from the chocies? Because right now in JSON in LicenceType, i have number of Choice (Value), but i need to get the name (label) of choice. 

 

Thanks a lot

 

Jan Lemon 

  • AhmedSalih Profile Picture
    6,678 Super User 2025 Season 1 on at
    Re: Get a Label from Choices to tje JSON file

    @janlemon, in this case, you need to use this:

    LicenceType: LookUp(LM_Products,licenceType = licenceType.Unlimited Perpetual Licence,licenceType)
  • janlemon Profile Picture
    on at
    Re: Get a Label from Choices to tje JSON file

    I am trying to just get the label from Choice saved in Dataverse in LM_Products in Column LicenceType. Still getting the value (1 or 2) but not the name of licence. 🙂 

  • AhmedSalih Profile Picture
    6,678 Super User 2025 Season 1 on at
    Re: Get a Label from Choices to tje JSON file

    @janlemon, so are you trying to pass one value from the choices?

    LicenceType: LookUp(Choices(LM_Products.LicenceType), Value = licenceType.Unlimited Perpetual Licence).Value
  • janlemon Profile Picture
    on at
    Re: Get a Label from Choices to tje JSON file

    Sorry, you are right, licenceType is variable and i am using it wrong. :- D

     

    ..this variable it's just for the filtering purposes in different screen - user first choose, if he wants to see products (fe. photoshop, O365, which are under the Subcription label or under the Unlimited Perpetual L.). 

     

    I know, that there is possible to pass on the variable to the json file, but i would like to get the name from the Choice from Dataverse.

     

    This choice is not populated from the app, it must be Hard coded directly in Dataverse (service user in case of addition new Product can choose only from these 2 choices).

  • AhmedSalih Profile Picture
    6,678 Super User 2025 Season 1 on at
    Re: Get a Label from Choices to tje JSON file

    @janlemon, great!  the licenseType after the "=" sign, is entered by the end-user? Is it a variable?

     

    AhmedSalih_0-1678894669932.png

     

  • janlemon Profile Picture
    on at
    Re: Get a Label from Choices to tje JSON file

    Display Name in table LM_Products is:

    • LicenceType 

    Name is:

    • new_licenceType

    Choice was created by me in Environment and the choice is called:

    • LicenceType

    There are 2 choices:

    • Unlimited Perpetual Licence
    • Subscription

     

    I am able to get the values from the choices (Unlimited Perpetual = 0 , Subscription = 1), but not able get the Labels (names).

     

    Thanks

     

  • AhmedSalih Profile Picture
    6,678 Super User 2025 Season 1 on at
    Re: Get a Label from Choices to tje JSON file

    @janlemon, what is the Display Name of your Choice List? When you created the Choice Column in the LM_Product, you created a choice list? What is the Display name of it?

     

  • janlemon Profile Picture
    on at
    Re: Get a Label from Choices to tje JSON file

    Yes please, there are 2 choices which user can set default for each product and i need to get the label from seted choice.

     

    table is:

    LM_Product

    searching for specific product with ProductID

     

    the Table with choices is called: LicenseType

  • AhmedSalih Profile Picture
    6,678 Super User 2025 Season 1 on at
    Re: Get a Label from Choices to tje JSON file

    Hello, @janlemon , Is Dataverse your data source?

     

    If my reply helped you, please give a 👍  , & if it solved your issue, please give a 👍 & Accept it as the Solution to help other community members find it more.

    I am primarily available on weekdays from 6-10 PM CT and 5-10 PM CT on weekends.

    Visit my Blog: www.powerplatformplace.com

    Visit my YouTube Channel: https://www.youtube.com/@powerplatformplace/videos

    New Project.png

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 1

Featured topics