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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Get a Label from Choic...
Power Apps
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 

I have the same question (0)
  • AhmedSalih Profile Picture
    6,680 Moderator on at

    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

  • janlemon Profile Picture
    on at

    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,680 Moderator on at

    @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

    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,680 Moderator on at

    @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

    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,680 Moderator on at

    @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

    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,680 Moderator on at

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

    LicenceType: LookUp(LM_Products,licenceType = licenceType.Unlimited Perpetual Licence,licenceType)

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 549 Most Valuable Professional

#2
Kalathiya Profile Picture

Kalathiya 225 Super User 2026 Season 1

#3
Haque Profile Picture

Haque 224

Last 30 days Overall leaderboard