reactjsmicrosoft-dynamicspcf

PCF Component save data to SingleLineText


i have a small problem:

I coded a checklist for MS Dynamics 365 as a pcf component. Now I have the problem that i can't save the data.

The Checklist's data is stored in a JSON format.

I want to store this JSON in the entity.

This is my property. <property name="saveCheckList" display-name-key="datom_saveCheckList" description-key="Property_Desc_Key" of-type="SingleLine.TextArea" usage="bound" required="true" />

Can you please tell me how I store the data. Thank you! If you need more informations do't worry to ask.


Solution

  • you need to ensure that the PCF method getOutputs returns the data being stored in your component code. For example, we store a JSON in the control and if we want the control to tell the Dynamics 365 to save the actual data, we use it like this:

    /**
         * It is called by the framework prior to a control receiving new data.
         * @returns an object based on nomenclature defined in manifest, expecting object[s] for property marked as “bound” or “output”
         */
        public getOutputs(): IOutputs {  
            // Our method to retrieve JSON.
            let data = this.priceIndexationData.getData();
    
            // And we tell the framework to save the JSON to bound property (declared in control's manifest)
            return { priceIndexationData: data }
        }
    

    Manifest line of declaring the "priceIndexationData" in our case:

    <property name="priceIndexationData" display-name-key="Price Indexation Data" description-key="ken_priceindexationdata field value." of-type="Multiple" usage="bound" required="true" />