cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
trishmalloy
Level: Powered On

Syntax for submitting 2 forms to SP list

Hello,

 

I have 2 SP lists, one with client info and the second has client workout data.  The second list pulls a client name from a lookup column.  When a new workout is created it pulls in the select client's name (Items property = Gallery2.selected) this is a View Form.  Then the trainer fills out the client workout Edit form.  I'm wanting to submit the client name and workout data to the second SP list.  The workout data submits no problem.  I'm not sure how to populate the selected client's name in this SP list.

 

Trish

1 ACCEPTED SOLUTION

Accepted Solutions
v-siky-msft
Level 10

Re: Syntax for submitting 2 forms to SP list

Hi @trishmalloy ,

 

Apologize for the delay reply.

<BaseRecord> is the record that Form2 submitted , in other words, that is the record you want to add client name to.

I think you should use lookup function to findout that record, but since it was the last submitted record, you can use Last() to find out it.

You can try this:

SubmitForm(Form2);
Patch('client workout data',Last('client workout data'),{'client name':{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",Id:Gallery2.Selected.ID, Value:Gallery2.Selected.'Client Name'}})

Hope this help.

 

Best regards,

Sik

 

View solution in original post

13 REPLIES 13
Super User
Super User

Re: Syntax for submitting 2 forms to SP list

@trishmalloy 

Hi there.  It sounds like you want to see the Client's Name in your Workout Data List.  In Sharepoint, goto your Workout Data List, then list settings, and look at the setup options for your LookUp column.  You can bring in additional fields (i.e. Client Name) just as I have shown below.

 

This is advantageous vs storing the Client Name in the Workout Data List because any changes to the Client's Name (e.g. Last Name change due to marriage) will show up automatically in the Workout Data List.

 

imgxyz.png

 

---

Please click "Accept as Solution" if my response helped to solve your issue so that others may find it more quickly.  If your thought the post was helpful please give it a "Thumbs Up."

v-siky-msft
Level 10

Re: Syntax for submitting 2 forms to SP list

Hi @trishmalloy ,

 

Is the client name  looked up from 'client info' list?

Do you mean that the edit form only have workout data, but you also want to submit the client name which has been selected before editing form to SP list ?

 

To patch a Sharepoint column, you should patch the record to it. In the record, it contains three required parameters ('@odata.type', ID and Value).

  • For the '@odata.type' field (Which I think is a predefined column), just copy and paste the following: '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"
  • ID and Value is from the record what you look up

So try to put the following formuals to Submit button:

Patch('client workout data',Gallery2.Selected,{'client name':{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",Id:<ID>, Value:<Value>}})

 

Best regard,

Sik

 

trishmalloy
Level: Powered On

Re: Syntax for submitting 2 forms to SP list

I must not be understanding what you're suggesting.  This is already set up on my 'Create Workout' list.  See attachment.  

 

The Client Workout screen has 2 forms, I pulled in the name of the client by using Gallery2.selected and the other form has the fields for creating a workout.  I am looking for submit/patch syntax for saving the record.  Right now the workout data is being saved but not the client name.

trishmalloy
Level: Powered On

Re: Syntax for submitting 2 forms to SP list

I must be missing something, can you clarify?  See attachment.

Super User
Super User

Re: Syntax for submitting 2 forms to SP list

@trishmalloy 

Okay.  I did not understand that you were looking for Patch formula syntax.  I will let @v-siky-msft work throught this with you because they will be more knowledgable on the subject.

v-siky-msft
Level 10

Re: Syntax for submitting 2 forms to SP list

Hi @trishmalloy ,

 

As you said, there are two forms on the screen, form1 shows the client name selected from gallery2, and form2 is to create a workout, right?

What is the data source of gallery2, List of client?

Do you want to patch the client name to the work out record created by form2, right?

 

If my assumption is right, the formula needs to modify as below:

 

Patch('client workout data',<BaseRecord>,{'client name':{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",Id:<ID>, Value:<Value>}})

Note:

 

<BaseRecord> is the record submitted by form2, you need to use lookup function to find out that record you just created.

You also need to modify <ID> and <Value> which are from the record you looked up. Since the client is selected from gallery2, they may be that <Id> is Gallery2.Selected.ID, <Value> is Gallery2.Selected.'Client Name'.

 

 

 

Best regards,

Sik

trishmalloy
Level: Powered On

Re: Syntax for submitting 2 forms to SP list

I'm sorry if I'm not explaining this correctly.  I first need to know how to create a record from 2 forms with the correct syntax.  

v-siky-msft
Level 10

Re: Syntax for submitting 2 forms to SP list

Hi @trishmalloy ,

 

To create a record from 2 forms, we have to firstly submit a record from Form2, and then patch the client name to that record(<BaseRecord>).

So, just put following formulas to OnSelect of Button in the upper right corner.

SubmitForm(Form2);
Patch('client workout data',<BaseRecord>,{'client name':{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",Id:<ID>, Value:<Value>}})

Best regards,

Sik

trishmalloy
Level: Powered On

Re: Syntax for submitting 2 forms to SP list

Hi @v-siky-msft ,

 

I'm sorry to be a moron, I still need some help ... I'm not sure what to put in <BaseRecord>, I took a guess and put Gallery2.Selected. 

 

SubmitForm(Form2);Patch('Create Workout - Set 1_3',Gallery2.Selected{"Title":{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",Id:<ID>,Value:<Value>}})

 

I'm getting the attached error message, "The specified column 'Client_x0020_Goals' does not exist'.  This field has nothing to do with this screen.  It is only used on the Client Profile screens.  I see this error when I mouse over the word "Selected"

Helpful resources

Announcements
thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (6,442)