cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Skilled Sharer
Skilled Sharer

Field type PCF component inside a CanvasApp Form: how to save it?

I'm an bloody beginner in CanvasApps, but since the PCF for CanvasApps is now in Preview, I would like to try it out. 

I've supposed that the PCF inside CanvasApps should work the same way they do for ModelDriven Apps. 

I have my PCF Textarea control inside a EditForm, inside a custom DataCard, the same as the standard OOB attributes are linked. I can see the data shown in my PCF control.  

But I don't get the data saved back to CDS. I guess for the OOB controls this happens through the Update Property of the DataCard, but my custom DataCard doesn't have the "Update" property. 

That's why my question: is there a way to link my PCF control both ways (input & output) to the DataForm? If I have to take care of saving by myself, then the PCF control is not really integrated in my EditForm. Pretty sure I'm missing something...

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Field type PCF component inside a CanvasApp Form: how to save it?

Hi @DianaBirkelbach ,

Do you add a custom data card within your Edit form, then insert your PCF control inside the custom data card?

 

Currently, if you want to save the Edit form fields values back to your data source (e.g. CDS Entity), these fields must be bind to specific field in your data source. But the custom data card within Edit form could not be bind to any field in your data source.

 

As an alternative solution, I think the Patch function and the OnSuccess property of Edit form could achieve your needs.

Set the OnSelect property of "Submit" button to following:

Set(TextAreaOutput, TextAreaPCFControl.OutputProperty);  // Save the PCF control output value into a variable
SubmitForm(EditForm1)

Please set the OnSuccess property of the Edit form to following:

Patch(
      'Your CDS Entity',
       EditForm1.LastSubmit,
       {
         TextField: TextAreaOutput     // TextField represents the Text type field in your CDS Entity to store PCF control output value
       }
);
Set(TextAreaOutput, Blank());
Back()

 

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Highlighted
Community Support
Community Support

Re: Field type PCF component inside a CanvasApp Form: how to save it?

Hi @DianaBirkelbach ,

Do you add a custom data card within your Edit form, then insert your PCF control inside the custom data card?

 

Currently, if you want to save the Edit form fields values back to your data source (e.g. CDS Entity), these fields must be bind to specific field in your data source. But the custom data card within Edit form could not be bind to any field in your data source.

 

As an alternative solution, I think the Patch function and the OnSuccess property of Edit form could achieve your needs.

Set the OnSelect property of "Submit" button to following:

Set(TextAreaOutput, TextAreaPCFControl.OutputProperty);  // Save the PCF control output value into a variable
SubmitForm(EditForm1)

Please set the OnSuccess property of the Edit form to following:

Patch(
      'Your CDS Entity',
       EditForm1.LastSubmit,
       {
         TextField: TextAreaOutput     // TextField represents the Text type field in your CDS Entity to store PCF control output value
       }
);
Set(TextAreaOutput, Blank());
Back()

 

Please consider take a try with above solution, then check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Skilled Sharer
Skilled Sharer

Re: Field type PCF component inside a CanvasApp Form: how to save it?

Thank you Kris Dai 🙂 It worked like a charm 🙂

So adding custom DataCard within my EditForm doesn't help much. I can place my PCF control directly on my EditScreen.

I like the solution with the variable. In guess, if I would worry about the transaction while saving data, I should save everything with a Patch inside the "OnSelect" event of Submit button, but then I have to care about all other fields.

Thanks again. 😊

Best regards,

Diana

 

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

Users online (8,319)