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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

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

(0) ShareShare
ReportReport
Posted on by

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.

I have the same question (0)
  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    Can you please provide your ControlManifest.Input.xml file?

  • Community Member Profile Picture
    on at

    <?xml version="1.0" encoding="utf-8" ?>

    <manifest>

     <control namespace="test" constructor="MultiSelect1N" version="0.0.3" display-name-key="MultiSelect1N" description-key="MultiSelect1N description" control-type="standard">

       <property name="value" display-name-key="Value" description-key="Value" of-type="SingleLine.Text" usage="bound" required="true" />

       <property name="linkedEntityUniqueId" display-name-key="Linked Entity Unique Id" description-key="linkedEntityUniqueId" of-type="SingleLine.Text" usage="input" required="false" />

       <property name="linkedEntityName" display-name-key="Linked Entity Schema Name" description-key="Linked Entity Schema Name" of-type="SingleLine.Text" usage="input" required="false" />

       <property name="linkedEntityPluralName" display-name-key="Linked Entity Plural Schema Name" description-key="linkedEntityPluralName" of-type="SingleLine.Text" usage="input" required="false" />

       <property name="linkedEntityParentFieldSchemaName" display-name-key="Linked Entity Parent Field Schema Name" description-key="linkedEntityParentFieldSchemaName" of-type="SingleLine.Text" usage="input" required="false" />

       <property name="linkedEntityChildFieldSchemaName" display-name-key="Linked Entity Child Field Schema Name" description-key="linkedEntityChildFieldSchemaName" of-type="SingleLine.Text" usage="input" required="false" />

       <property name="childEntitySchemaName" display-name-key="Child Entity Schema Name" description-key="childEntitySchemaName" of-type="SingleLine.Text" usage="input" required="false" />

       <property name="childEntityPluralSchemaName" display-name-key="Child Entity Plural Schema Name" description-key="childEntityPluralSchemaName" of-type="SingleLine.Text" usage="input" required="false" />

       <property name="relationshipEntity" display-name-key="Parent Entity Schema Name" description-key="Parent Entity Schema Name" of-type="SingleLine.Text" usage="input" required="false" />

       <property name="parentEntityPluralSchemaName" display-name-key="Parent Entity Plural Schema Name" description-key="parentEntityPluralSchemaName" of-type="SingleLine.Text" usage="input" required="false" />

       <property name="relationshipName" display-name-key="Relationship Scehma Name" description-key="Relationship Schema Name" of-type="SingleLine.Text" usage="input" required="false" />

       <property name="nameAttribute" display-name-key="Linked Entity Name Attribute" description-key="Linked Entity Name Attribute" of-type="SingleLine.Text" usage="input" required="false" />

       <property name="idAttribute" display-name-key="Linked Entity ID Attribute" description-key="Linked Entity ID Attribute" of-type="SingleLine.Text" usage="input" required="false" />

       <property name="linkedEntityFetchXmlResource" display-name-key="FetchXml Web Resource" description-key="Optional FetchXml web resource to select linked entity records" of-type="SingleLine.Text" usage="input" required="false" />

       <property name="asscLinkedEntityFetchXmlResource" display-name-key="FetchXml Web Resource (Associated Only)" description-key="Optional FetchXml web resource to select linked entity records - associated only" of-type="SingleLine.Text" usage="input" required="false" />

       <property name="remoteODATA" display-name-key="remote data query string" description-key="Use webapi query to search linked entity records on demand" of-type="SingleLine.Text" usage="input" required="false" />

       <property name="keyValueParameters" display-name-key="Comma separated parameters" description-key="Comma separated fieldschemaname:value" of-type="SingleLine.Text" usage="input" required="false" />

       <property name="pluralEntityUIName" display-name-key="Entity UI name plural" description-key="Optional entity UI name to say on control" of-type="SingleLine.Text" usage="input" required="false" />

       <property name="maximumSelectionLength" display-name-key="Maximum Selection Length" description-key="Maximum Selection Length" of-type="SingleLine.Text" usage="input" required="false" />

        <property name="descriptionAttribute" display-name-key="Description attribute" description-key="Description attribute. Separate with comma to use multiple description attributes. " of-type="SingleLine.Text" usage="input" required="false" />

       <feature-usage>

          <uses-feature name="WebAPI" required="true" />

       </feature-usage>

       <resources>

         <code path="index.ts" order="1"/>

         <css path="css/select2.min.css" order="2" />

         <css path="css/common.css" order="3" />

       </resources>

     </control>

    </manifest>

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    The easiest way to use the optionset field in the code of your control is to add add the new property of the optionset type, handle it in the code and bound it in the settings of the PCF.

  • Community Member Profile Picture
    on at

    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...

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

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

  • Community Member Profile Picture
    on at

    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

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

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

  • Community Member Profile Picture
    on at

    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?

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    It should be something like, according to your code:

    let optionsetValue = context.parameters.clientType.raw;

  • Community Member Profile Picture
    on at

    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

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 137 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 57

#3
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans