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

HELP list A to list B and update list B if needed

I really need help with this flow and my previous post haven't worked.

 

I have 2 lists.

 

List Projects

List NCSA

 

When a user inputs and item in list projects and the area selected is NCSA then I want to create an item in list NCSA. Pretty much copy what was inputed in list projects to list NCSA, but only if the area in projects is NCSA. Every time a certain item in list projects with area NCSA is changed then I wanted it to update the second list.

 

Please help. Please show me step by step how this would look. I have the same fields in both lists except for list NCSA I have "listAID" as a number type.

1 ACCEPTED SOLUTION

Accepted Solutions
manuelstgomes
Super User II
Super User II

Hey @karlagb20 

 

Here you go.

 

Creating the SharePoint

To test, I created 2 Lists.

Screenshot 2019-08-22 at 16.33.26.pngScreenshot 2019-08-22 at 16.33.35.png

I think this is what you have but with more fields. For this explanation, this will do.

 

Flow

In the flow you need to:

  1. Check if something was created or modified
  2. Check if it's NCSA
  3. If it's NCSA check if it already exists
    1. If I can find an item, update the values
    2. If not creates it.

Let's do that. Here's the flow. 

 

Screenshot_2019-08-22_at_16_37_07.jpg

This takes care of the validation.

 

Now let's explore the "Yes" Part:

Screenshot_2019-08-22_at_16_40_10.jpg

You have three parts:

  1.  Is there a listAID with the same as the updated value? If yes then I go in the update path and update the value
  2. If not, I create one.

In the compose, add the following code:

 

length(body('Get_items')?['value'])

It will return the number of items (usually one or zero).

 

 

Is this what you need?

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

View solution in original post

5 REPLIES 5
manuelstgomes
Super User II
Super User II

Hey @karlagb20 

 

Here you go.

 

Creating the SharePoint

To test, I created 2 Lists.

Screenshot 2019-08-22 at 16.33.26.pngScreenshot 2019-08-22 at 16.33.35.png

I think this is what you have but with more fields. For this explanation, this will do.

 

Flow

In the flow you need to:

  1. Check if something was created or modified
  2. Check if it's NCSA
  3. If it's NCSA check if it already exists
    1. If I can find an item, update the values
    2. If not creates it.

Let's do that. Here's the flow. 

 

Screenshot_2019-08-22_at_16_37_07.jpg

This takes care of the validation.

 

Now let's explore the "Yes" Part:

Screenshot_2019-08-22_at_16_40_10.jpg

You have three parts:

  1.  Is there a listAID with the same as the updated value? If yes then I go in the update path and update the value
  2. If not, I create one.

In the compose, add the following code:

 

length(body('Get_items')?['value'])

It will return the number of items (usually one or zero).

 

 

Is this what you need?

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

View solution in original post

manuelstgomes
Super User II
Super User II

Hey @karlagb20 

 

Here you go.

 

Creating the SharePoint

To test, I created 2 Lists

  1. Project with Title and Area (Choice)
  2. NCSA with Title and listAID

 

I think this is what you have but with more fields. For this explanation, this will do.

 

Flow

In the flow you need to:

  1. Check if something was created or modified
  2. Check if it's NCSA
  3. If it's NCSA check if it already exists
    1. If I can find an item, update the values
    2. If not creates it.

Let's do that. Here's the flow. 

 

Screenshot_2019-08-22_at_16_37_07.jpg

This takes care of the validation.

 

Now let's explore the "Yes" Part:

Screenshot_2019-08-22_at_16_40_10.jpg

You have three parts:

  1.  Is there a listAID with the same as the updated value? If yes then I go in the update path and update the value
  2. If not, I create one.

In the compose, add the following code:

 

length(body('Get_items')?['value'])

It will return the number of items (usually one or zero).

 

 

Is this what you need?

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

@manuelstgomes wait... it doesn't update. instead it creates the same item again even though i only updated it on the projects list

@karlagb20 it's probably the IDs. Let's check them:

Screenshot_2019-08-23_at_15_07_16.jpg

  1. From the "When an item is created"
  2. From Apply To Each
  3. From the "When an item is created"
  4. From the "When an item is created"

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

@manuelstgomes It didn't work. It went straight to creating an item even though all I changed was a couple numbers on the original item. Below is how my flow looks, is something wrong? Why is it skipping update item?false.PNGsh.PNG

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Kudoed Authors
Users online (65,044)