Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Suggested answer

Access D365 fields (on create of record) in PCF control

Posted on by Microsoft Employee

Hi, I have a pcf control, its working perfectly now. I got a new requirement.

There is an option set in the form with values as Single and Multiple.

If it’s Single, the pcf control should allow only one lookup value to be selected. Right now its always allowing multiple values. I have tried finding this options set control in index.ts but its not available. I tried onchange event of pcf control but its getting fired after the index.ts is finished. How can I capture the value of option set in index.ts? I really appreciate your help. Thank you.

  • a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: Access D365 fields (on create of record) in PCF control

    Just check the other videos available here - www.youtube.com/watch

    Part of it covers the updateView method.

    Good luck.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Access D365 fields (on create of record) in PCF control

    this is my first task on PCF. running out of deadline. Any help on what to write in the updateview please?

  • a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: Access D365 fields (on create of record) in PCF control

    If you change the value outside of the PCF you should write code that handles the change in updateView function.

    If you change the value inside your PCF you should "notify" form that field was changed using notifyOutputChanged handler passed to the init method.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Access D365 fields (on create of record) in PCF control

    Thanks again for quick reply. I have tried it but it's giving the saved value of the option set. I have selected multi option and saved it. When I change it back to single and select a value in PCF control, it's still showing the Multi value only.

    if (context.parameters.clientType.raw != null) {            

               this._clientType = context.parameters.clientType.raw;

           }

    Any help please?

    sc1.PNG2804.sc2.PNG

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: Access D365 fields (on create of record) in PCF control

    It should be something like, according to your code:

    let optionsetValue = context.parameters.clientType.raw;

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Access D365 fields (on create of record) in PCF control

    Hi Andrew, thank you for your reply. I don't know how to fetch the selected value of optionset in index.ts file. I was trying using the getValue() but it's throwing exception. Can you help me how to fetch it please?

  • a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: Access D365 fields (on create of record) in PCF control

    Hello,

    What code do you use to get the value of the mentioned optionset field?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Access D365 fields (on create of record) in PCF control

    Thanks Andrew, I have gone through the video, I have created the key in the manifest.

    <property name="clientType" display-name-key="Client Type" description-key="Description " of-type="OptionSet" usage="bound" required="false" />

    it's giving all the properties and values of the optionset field in the index.ts. I want the dynamic value, when the pcf control value is selected, I need to capture the latest value of option set. Any help?

    688636.Capture.PNG

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: Access D365 fields (on create of record) in PCF control

    You can check this - www.youtube.com/watch

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Access D365 fields (on create of record) in PCF control

    Thanks for the reply. Could you please send me a screenshot of it, if you have? It's my first time working on PCF. Lot of confusion...

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans