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
@janlemon, in this case, you need to use this:
LicenceType: LookUp(LM_Products,licenceType = licenceType.Unlimited Perpetual Licence,licenceType)
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. 🙂
@janlemon, so are you trying to pass one value from the choices?
LicenceType: LookUp(Choices(LM_Products.LicenceType), Value = licenceType.Unlimited Perpetual Licence).Value
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).
Display Name in table LM_Products is:
Name is:
Choice was created by me in Environment and the choice is called:
There are 2 choices:
I am able to get the values from the choices (Unlimited Perpetual = 0 , Subscription = 1), but not able get the Labels (names).
Thanks
@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?
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
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 |
WarrenBelz
791
Most Valuable Professional
MS.Ragavendar
410
mmbr1606
275
Super User 2025 Season 1