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

Looking to set default value of a field to another field, and some other things listed below

I am working on a lunch and learn powerapp here is what I am looking to accomplish in powerapps

I have two lists

1. Class Attendees

2. Calendar List

 

1. I Create an item in calendar list about lunch and learn, I set the category field to Lunch and Learn (this will always be the value of the category field)

2. Upon saving item in calendar users get an email about lunch and learn (I already know how to do this)

3. User clicks on link in email which brings them to powerapp form, once the power app form appears I want it to automatically close and due the following Set my attending field on the class attendees list to yes and then also write out the category field from the calendar list which is always the same value LUNCH and LEARN to the Meeting field in Class Attendees list, this meeting field is a lookup field from the Category field in the Calendar list. (Need to learn how to automatically close the form and set the attending field to yes and write out category to meeting field upon closing the form after user clicks on link)

 Under the data section of the field Meeting I am using this under Default

If(
    LookUp(
        Choices('Calendar List'.Category),
        Value = "Lunch and Learn"),
    Parent.Default)

However this does not automatically fill the field Like i want to when the form loads, it seems like it does but does not write out the Lunch and Learn value to the meeting field upon saving the form.

 

I know also I can use this formula when click the submit button to write out YES to my attending field

 Patch(
     'Attendees List',
      Form1.LastSubmit,
      {
        Attending: true     /* <- Change YES into true */
      }
)

 Is what I am asking above possible? If so any help would be greatly appreciated

4 REPLIES 4
Community Support Team
Community Support Team

Re: Looking to set default value of a field to another field, and some other things listed below

Hi @Smatera9681,

Could you please share a screenshot about the form that you mentioned? Is it a custom form in your SP list?

Do you want to set a default value (Lauch and Learn) from your calendar list for the Meeting field of your 'Attendees' list?

Based on the formula that you mentioned, I think there is something wrong with it.

I have made a test on my side, please take a try with the following workaround:6.JPG

Set the DefaultSelectedItems property of the Combo Box control within the School Data card to following:

If(
    SharePointForm1.Mode = FormMode.New,
    {
        Id: LookUp('20190108_School', School="PowerApps", ID),
        Value: "PowerApps"
    },
    Parent.Default
)

On your side, you should set the DefaultSelectedItems property of the Combo Box control within the Meeting Data card to following:

If(
    Form1.Mode = FormMode.New,
    {
        Id: LookUp('Calendar List', Category = "Lunch and Learn", ID), /* <- I assume that the Category column is a Single line text type column in your 'Calendar List'*/
        Value: "Lunch and Learn"
    },
    Parent.Default
)

Note: Please add your 'Calendar List' as a data source within your app firstly. Please set  DefaultSelectedItems property (rather than Default) of the Combo Box control to above formula.

Or

If(
    Form1.Mode = FormMode.New,
    LookUp(Choices('Calendar List'.Category), Value = "Lunch and Learn"),
    Parent.Default
)

More details about setting a default value for a LookUp field in PowerApps, please check the following thread:

https://powerusers.microsoft.com/t5/General-Discussion/Save-Filtered-Lookup-Value-in-List-Custom-For...

Please also check and see if the following blog would help in your scenario:

https://powerapps.microsoft.com/en-us/blog/default-values-for-complex-sharepoint-types/

 

Best regards,

Kris

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.
Smatera9681
Level: Powered On

Re: Looking to set default value of a field to another field, and some other things listed below

Hi Kris

 

Thanks for the reply, here is a screenshot of my form

 

Do you want to set a default value (Lauch and Learn) from your calendar list for the Meeting field of your 'Attendees' list?  Yes, I want to always set the value of Lunch and Learn to the Meeting filed in my Attendees list when they load the form, see pic attached as the combo box worked however I would like to have it populate the meeting field and write directly to the meeting field in SharePoint on the Attendees list.  I used your formula below for the combo box field

If(Form1.Mode = FormMode.New,
    {Id: LookUp('Calendar List', Category = "Lunch and Learn", ID), /
        Value: "Lunch and Learn"
    },Parent.Default)

 

I added the Calendar List as another data source as you recommended.  Let me know what I am missing, as my original post really states what I am looking to accomplish

 

AS a side note the MEETING Field from the attendees list is a lookup field looking at the Calendar List Category field.  Hope this all helps

 

Thanks again

 

 

Community Support Team
Community Support Team

Re: Looking to set default value of a field to another field, and some other things listed below

Hi @Smatera9681,

Have you solved your problem?

Have you taken a try with the solution I provided?

Based on the needs that you mentioned, I think the solution I provided above could achieve your needs.

Please take a try with above solution, check if the issue is solved on your side.

If the issue still exists, please consider share more details about the issue within your app here, I would provide a proper workaround for you.

 

If you have solved your problem, please go ahead to click "Accept as Solution" to identify this thread has been solved for other users.

 

Best regards,

Kris

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.
Smatera9681
Level: Powered On

Re: Looking to set default value of a field to another field, and some other things listed below

Hey Kris

 

Still having issues writing out the value of Lunch and Learn to the Meeting field and having it write to my SP list.  THe combo box does populate with lunch and learn however the Meeting field which is a lookup field from the Category field, I will add the category field in my Calendar is the standard calendar choice field that is default with a calendar list in SharePoint.  let me know if that helps to shed light on things

 

Thanks