Problem Statement
The problem is that if you use out of the box Dynamics 365 Connector for PowerApps, it only retrieves the numeric value of the optionset. It does not return the text value of the optionsets. Below, I have added a Preferred Method of Contact field to the DetailScreen1.As shown in the screenshot above, Preferred Method of Contact of 1 means nothing to a business user. It should display email, phone, mail, etc.
Solution
The Dynamics CRM connector for PowerApps does not display the text values of the optionsets or the metadata of the entities. So, there is no straight forward solution for this problem, but we can use something similar to a data maps table that contains what these numeric values mean.Here are the steps:
Create a collection
We will create a collection (https://powerapps.microsoft.com/en-us/tutorials/create-update-collection/) to store the optionset values and the corresponding text.1. Open the BrowseScreen1, choose On Start from the Actions Menu and add the following code.
Collect(Myc, {optionset:"PreferedContact", OptionValue:1,DisplayText:"Any"},{optionset:"PreferedContact", OptionValue:2,DisplayText:"Email"},{optionset:"PreferedContact", OptionValue:3,DisplayText:"Phone"},{optionset:"PreferedContact", OptionValue:3,DisplayText:"Fax"},{optionset:"PreferedContact", OptionValue:3,DisplayText:"Mail"})
The above code will create a collection Myc.
- DisplayText- displays the text of the optionset
- OptionValue- displays the numeric value of the optionset
- Optionset- displays the name of the optionset field. This field will be useful to the store the values for the multiple optionset fields in the same collection.
Display the Optionset Text
We will be using the PowerApps Lookup function to display the text for the optionset.- Open the DetailScreen1 and select the optionset field, as shown on the screen in the screenshot below.
- Click on the Unlock the change properties.
- Change the Data property to LookUp(Myc,((OptionValue=preferredcontactmethodcode)&&(optionset="PreferedContact")),DisplayText).
- The DetailScreen1 will display the text associated with the optionset numeric value.
Editing the Optionsets in PowerApps
The above solution can show the text, but won’t let the user edit the values in the app. The solution to allow users to edit the optionsets values in PowerApps is little tricky.Here are the steps to achieve this.
- Add the Preferred Method of Contact optionset to EditScreen1.
- Change the display for the field to Allowed Values as shown in the screenshot below. It will change the field to a dropdown field.
- Click on the Unlock the change properties.
- Select the dropdown field and change the Items property to collection Myc. In the dropdown properties pane, select the column to display in the Value field. By default, the first column of the collection is selected.
- Change the Default property to LookUp(Myc,((OptionValue=preferredcontactmethodcode)&&(optionset="PreferedContact")),DisplayText).
- Select the optionset card and change the Update property to DataCardValue4.Selected.OptionValue. This will tell the card to use the OptionValue field of the collection to update in CRM.
- Save the application and test it.
Thank you so much!
ReplyDeleteAll given information was wonderful and thanks for sharing.
ReplyDeleteMicrosoft Dynamics AX Online Training
Thank your valuable content.we are very thankful to you.one of the recommended blog.which is very useful to new learners and professionals.content is very useful for hadoop learners
ReplyDeleteBest ASP.NET MVC Online Training Institute
Best Spring Online Training Institute
Best Devops Online Training Institute
Best Datascience Online Training Institute
Best Oracle Online Training Institute
Best AWS Online Training Institute
Best AngularJS Online Training Institute
Thank your valuable Information...
ReplyDeleteYaaron Studios is one of the rapidly growing editing studios in Hyderabad. We are the best Video Editing services in Hyderabad. We provides best graphic works like logo reveals, corporate presentation Etc. And also we gives the best Outdoor/Indoor shoots and Ad Making services.
Best video editing services in Hyderabad,ameerpet
Best Graphic Designing services in Hyderabad,ameerpet
Best Ad Making services in Hyderabad,ameerpet
Informative post. Thanks for sharing
ReplyDeleteMicrosoft dynamics 365
It is so nice blog. I was really satisfied by seeing this blog.
ReplyDeleteSQL Azure Online Training
Azure SQL Training
SQL Azure Training
This comment has been removed by the author.
ReplyDeleteThanks for sharing such a great blog Keep posting.
ReplyDeleteCRM
Company Database India
relationship intelligence
Thanks for sharing, nice post! Post really provice useful information!
ReplyDeleteHương Lâm chuyên cung cấp máy photocopy, chúng tôi cung cấp máy photocopy ricoh, toshiba, canon, sharp, đặc biệt chúng tôi có cung cấp máy photocopy màu uy tín, giá rẻ nhất.
Keep sharing the information with us. Read Also Customized CRM software.
ReplyDeleteAre you in need of a Loan/Funding for a project? Have you been trying to obtain a Loan from any of the Banks or Loan Companies and got Ripped off and they have refused to grant you the Loan because of bad credit? we offer all types of non-recourse Loan and funding at a low Interest Rate of 3% both long term and short term.
ReplyDeleteThe categories of Loan/financial funding offered include but not limited to: Business Loan, Personal Loan, Company Loan, Mortgage Loan, debt consolidation and financial funding for both turnkey and mega projects E.T.C. from a minimum of Euro / US$1Million to Euro / US$5Billion Max.
Kindly get in touch for further details and procedure markthomasfinanceltd@gmail.com
Whats-App no +919667837169
Dr. Mark Thomas
Regards
Do you need personal loan?
ReplyDeleteLoan for your home improvements,
Mortgage loan,
Debt consolidation loan,
Commercial loan,
Education loan,
Car loan,
Loan for assets.
financialserviceoffer876@gmail.com WhatsApp +918929509036
Emergency Cash Loans Hello Everybody, My name is Mrs. Phyllis Sue South. I live in UK London and i am a happy woman today? and i told my self that any lender that rescue my family from our poor situation, i will refer any person that is looking for loan to him, he gave me happiness to me and my family, i was in need of a loan of $350,000.00 to start my life all over as i am a single mother with 2 kids I met this honest and GOD fearing man loan lender that help me with a loan of $350,000.00 U.S. Dollar, he is a GOD fearing man, if you are in need of loan and you will pay back the loan please contact him tell him that is Mrs. Phyllis Sue South that refer you to him. contact Dr. James Eric via email: financialserviceoffer876@gmail.com Whats-App +918929509036
ReplyDeleteWonderful post,This article have helped greatly continue writing...
ReplyDeleteMedicine for AIDS in India
HIV I & II RNA PCR Quantitative-AIDS cure India
HIV,HSV,HbsAg Cure Treatment in India
Herpes simplex virus complete cure in Tamilnadu
HIV I & II RNA PCR Quantitative-AIDS cure in Tamilnadu
AIDS cure 100% for siddha in Tamilnadu
Awesome blog! CRM software providers in Madhapur Hyderabad
ReplyDeleteI really enjoy the blog article.Much thanks again.
ReplyDeleteMuleSoft training
MuleSoft online training
Thank you for sharing this informative and engaging blog post. I found the content to be both interesting and thought-provoking. Your writing style is clear and concise, making it easy to follow along and understand the key points.
ReplyDeleteDynamics Experts Dubai
Thank you for sharing this informative and engaging blog post. I found the content to be both interesting and thought-provoking. Your writing style is clear and concise, making it easy to follow along and understand the key points.
ReplyDeleteMicrosoft Dynamics Experts