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

Trigger a Flow to Create a New Record

Hello PowerApps users!

 

I am currently attempting to add a new record from data in one SharePoint list "List1" to "List2." I would like to utilize MS Flow. How would I get a new record to be added to "List2" if the button was pressed on the GUI connected to "List1"? I have attempted to do this without a manual trigger, but rather use an automatic trigger that was switched on when a list was updated. The end result was a continuous flow that has populated 32,000 records in a short amount of time.

 

Thank you.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Trigger a Flow to Create a New Record

Hi @ChiefSmo ,

Could you please share a bit more about the error messae within your app?

Could you please share a bit more about the CRNNumber column in your SP list? Is it a Number type column?

 

Based on the error within yuor Patch formula, it seems to tell that there is something wrong with your SP list name, and the value you provided for the CRNNumber column.

 

I have made a test on my side, don't have the issue that you mentioned. Please check if you have type a proper SP list name within your Patch function.

Also please check if you have provided proper values for all Required fields (e.g. Title column) of your SP list within your Patch formula.

In addition, if the CRNNumber column is a Number type column in your SP list, I think there is something wrong with the value you provided for the CRNNumber column. Please take a try to modify your formula as below:

Patch(
          'YourSPListName',
           Defaults('YourSPListName'),
           {
              Title: DataCardValue1.Text,        /* <-- Title field is a Required field in a SP list, must provide a value for it. If you specify other Required fields in your SP list, you must provide values for them witin '{ }' part of Patch function */
CRNNumber: Value(CRN_Input.Text) } )

Please specify proper values for all Required fields of your SP list within above Patch function.

Note: I assume that the CRN_Input represents a Text Input box within your app.

 

Please 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

11 REPLIES 11
Highlighted
Super User
Super User

Re: Trigger a Flow to Create a New Record

Are you initiating this flow from a PowerApp or is it running as a standalone flow?  If standalone, how is it intended to be invoked.  

 

If you are initiating with a PowerApp, why would you not create your record in list 2 directly in PowerApps?  Is there a specific reason you believe you need a flow to accomplish this?

Highlighted
Helper II
Helper II

Re: Trigger a Flow to Create a New Record

In this case there is information that needs to be added from one list to another and it is necessary that the information be organized so that there isn't clutter when reviewing documentation if imported as a CSV. In addition there are gallerys that are in place to show the current status as it moves along throughout the process.

 

I also have some choice boxes that are being converted to single line datatypes to be able to display them on another list. 

 

So what I'm working on is a request form.

 

First List: End user submits general information, it is either approved or denied if approved a record is added to the second list. 

 

Second List: An administrator will add information to the list and when complete they will hit a button to update a new list.. Considered a checklist. (The button is what I'm trying to achieve now.)

 

Third List: Some data from List2 is transfered over to this list. An administrator would validate the steps taken. Once this is done they can compile a file to store it in a Sharepoint Library.

 

Storage Folder: Stores the responses of the Administrator from List 3.

 

Highlighted
Helper II
Helper II

Re: Trigger a Flow to Create a New Record

I have One flow that is complete, it is outside of PowerApps and creates a new record if the request is approved. The part I'd like to add into PowerApps is a button that creates a new list in List3 when the Administrator clicks it. such as "Compile Checklist"

Highlighted
Super User
Super User

Re: Trigger a Flow to Create a New Record

I presume you admin will review a gallery with one or more items, select the one they want to take action on and then click a button (either from the gallery or from a subsequent screen) to create the checklist. 

 

You can use the Patch function to write to List3 by invoking it from the On Select action of the button.  I do this to write a record to an audit list every time someone makes an update to any of my other lists in an application.  It takes some information from the list being updated (like department and project) and writes it to the new list - similar to what you are trying to do.  Here's a good article on Patch:  https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-patch

 

Here's the example where I patch the Audit list (and subsequently the Department list) when the check mark (my equivalent of a button) is pressed.  In my case I am also saving changes to the original list via the SubmitForm.

Patch Audit.jpg

Highlighted
Helper II
Helper II

Re: Trigger a Flow to Create a New Record

I have a seperate save function, to update List 2, but taking your advice with the Patch function, do you see any issues with this? I am getting the error "The function 'Patch' has some invalid arguments."

 

Patch(Server Build Checklist1,
Defaults('Server Build Checklist1'),
  {IP_x0020_Address: IP_Input.Update,
  Heat_x0020_Ticket_x0020__x0023_: CRN_Input.Update,
  Project_x0020_Name: serverName_Input.Update})

Highlighted
Super User
Super User

Re: Trigger a Flow to Create a New Record

I never use table names with spaces in them, so I'm not sure of this but... I noticed you put the list name in single quotes where it is listed for defaults but did not where the table name was first listed after the patch.  I am suspected it doesn't understand the first list name because it is 3 distinct words, not one (or one as denoted by single quotes).  Try that first and see what else it tells you, if anything.

Highlighted
Helper II
Helper II

Re: Trigger a Flow to Create a New Record

You're right, I also tried using the proper name for it: "Server%20Build%20Checklist1" but it seems the spaces recognize it as 3 different words.

Highlighted
Super User
Super User

Re: Trigger a Flow to Create a New Record

That's why I never use spaces in my list or column names.  It is just easier to not have to deal with the spaces.  Perhaps a tab harder to read, but not so bad if you use underscores rather than just running the characters together.

Highlighted
Community Support
Community Support

Re: Trigger a Flow to Create a New Record

Hi @ChiefSmo ,

Could you please share a bit more about the error message within your Patch formula?

Do you want to add data into your SP List 3 when the Administrator clicks the button?

Further, Does the IP_Input,  CRN_Input and serverName_Input that you mentioned within your Patch formula represent the Data card in your Edit form?

 

If you want to add data (from your Second List) into your SP List 3 when the Administrator clicks the button, I agree with @LRVinNC 's thought almost. I think the Patch function could achieve your needs.

Please take a try to modify your formula as below:

 

Patch(
'Server Build Checklist1', /* <-- 'Server Build Checklist1' represents your third SP list, your SP list name should be wrapped with single quote ('') */ Defaults('Server Build Checklist1'), {
'IP Address': IP_Input.Update, 'Heat Ticket #': CRN_Input.Update, 'Project Name': serverName_Input.Update
}
)

Note: The 'IP Address', 'Heat Ticket #' and 'Project Name' represents the columns in your Third SP List -- 'Server Build Checklist1'. Your SP list name should be wrapped with single quote ('').

More details about Patch function, please check the following article:

Patch function

 

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.

Helpful resources

Announcements
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

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

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,519)