cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper I
Helper I

Patch multiple forms with complex fields to SharePoint

Hi guys,

I would like to know the best method for Patching multiple forms with complex fields back to a SharePoint list?   I have a Canvas app with multiple screens (about 3-4).  Each of these screens show different forms.  At least two of this screens show different forms depending on the value of a selected choice in the previous screen.

Currently, I am using the !IsBlank function to Patch only the forms which were filled out, and using the Form.Updates method to ensure new records are patched accordingly.   The part I'm having a hard time figuring out is the syntax necessary to submit all of the form updates along with the complex fields.

Any advice is helpful!  Thanks 

3 REPLIES 3
Resident Rockstar
Resident Rockstar

Hi @illmatic ,

If you are using the form then no need patch, simply submit the form on the last screen.

Like - First Submit the First Form and get the LastSubmit ID and Use the same LastSubit ID for Update the Record.

Thanks,

Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."-Vijay

Hi  @VijayTailor ,

Thanks for replying.  I do not understand what you mean with the first sentence.  I'm using all of the forms... they are all different and located on different screens. Seems like this would only work if the user is going back to make updates to the first one, or did I misunderstand?

Also, this does not address my main pain point, which is how do I submit complex fields back to a SharePoint list will simultaneously submitting several different forms [some of which have the complex fields in them] while maintaining only one record.

Hi @illmatic ,

My Approach works Like below.

 You had a multiscreen with multiple Form

First Approach - On YOu Filled the Data for First  Form then On Next button you submit the First Form and OnSuccess Property you can get the Last Submit ID.

Set(LastRecord,Form12.LastSubmit)

Now For the rest of the Form Set the DefaultForm Mode Edit.
and in Items Property you can set the last record.
and once the data Filled then Submit this form also, so Once you submit this automatically it will Update the Same Record remaining Field but if the source is different then you can use the last submit ID as Mapping Purpose. and Keep the Form Mode as New.

Second Approach (You can use your Logic) But- For Patching Complex Field Like Lookup Column / Or Choice Column / Or People Group Column then you can use Code Like below -

//For Patching Lookup/Complex Field into SP
'Project Name':{
            Id:ProjectID,
            Value: Project,
            '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"
        }
//For Patching Choices/Complex Field into SP
        WorkType:{
            
            Value: WorkType,
            '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"
        },

//For Patching People or Group /Complex Field into SP
varCurrentUser = User() function
User: {
                '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
                Claims: "i:0#.f|membership|"&Lower(varCurrentUser.Email),
                DisplayName: varCurrentUser.FullName,
                Email: Lower(varCurrentUser.Email),
                Picture: varCurrentUser.Image,
                Department: "",
                JobTitle: ""

              }

Thanks,
Vijay

Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."-Vijay



 


 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (7,077)