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

Getting data from one entity, adding more info and entering into another entity

Hi! I need some help... I am creating a canvas app for internal use. It is going to be more complex than what I describe below; but to keep this simple to explain, here you go:

 

The staff needs to perform a series of tasks when there is a new member sign up, or an existing member to renew the membership or an existing member to terminate the membership. We want to create an app to keep track of the status of the tasks.

 

On the first screen, the staff can pick "New Membership" "Renew Membership" and "Terminate Membership". Once the staff picks one, in the next screen, it allows to enter the member ID, and also shows a task list for the staff to perform. For each task, there is the task assignee dropdown, which the default value is the person who fills this form. In the dropdown, there are other staff names which you can change to.

 

The list of tasks are stored in the "Tasks" entity with this fields: Task Type, Task Description (where Task Type = New, Renew or Terminate".) (Note: the reason that I have this entity is to support the app requirement, which is allowed to add/update/delete tasks in the task list over time, but they also want to keep the historical tasks performed for that particular member).

 

When the 2nd screen shows up, I would like to show all the tasks from this entity filtered by task type, and also add the dropdown for the assignee.

For example, new member:

Member ID: memberA_ID

Task1, Staff1 (dropdown)

Task2, Staff1 (dropdown)

Task3, Staff2 (dropdown)

 

So up to this point, I know how to do it.

 

However, for the next part, I would like to ask for your help or input please. When the staff submit the form, I would like to save the member name, task(s), and assignee(s) to the another entity where the fields are: Member Name, Task Type, Task Description, Assignee, and Completion Status.

 

For example, when submit the form, these records are entered to the entity:

memberA_ID, New, Task1, Staff1, No

memberA_ID, New, Task2, Staff1, No

memberA_ID, New Task3, Staff2, No

 

How do I do that? Do I need to use collection and patch? If yes, how?

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
v-siky-msft
Community Support
Community Support

Hi @snowfox ,

 

First need to work with ForAll() function to loop through all items in Gallery, then use Patch() function to save the value to Entity B.

Since you haven't explain the data type of these field, I just take them as text type in the following example.

ForAll(
         GalleryName.AllItems, 
         Patch('Entity Name', Defaults('Entity Name'),{'Member Name': field1ofTask, 'Task Type': field2ofTask ,'Task Description': field3ofTask})
)


Hope this helps.

Sik

 

View solution in original post

4 REPLIES 4
v-siky-msft
Community Support
Community Support

Hi @snowfox ,

 

Do you mean saving the data value in Form to anther entity when submitting the button?

Please try to use Patch function with the following formula.

Patch('Entity Name', Defaults('Entity Name'),{'Member Name':DataCardValue1.Text , 'Task Type': DataCardValue2.Text ,'Task Description': DataCardValue3.Text}) //If these field are all Text type.

If the data types are not compatible, please share more details about the data type of two entity fields and some snapshots of Form so that we can provide further assistance.

 

Hope this helps.

Sik

snowfox
Helper I
Helper I

Hi @v-siky-msft ,

In fact, it's not a form. I would like to save the data from the gallery of Entity "Tasks" to Entity_B.

When saving records to Entity_B, I would like to add extra fields such as Task Assignee and Member_ID.

Thanks!

v-siky-msft
Community Support
Community Support

Hi @snowfox ,

 

First need to work with ForAll() function to loop through all items in Gallery, then use Patch() function to save the value to Entity B.

Since you haven't explain the data type of these field, I just take them as text type in the following example.

ForAll(
         GalleryName.AllItems, 
         Patch('Entity Name', Defaults('Entity Name'),{'Member Name': field1ofTask, 'Task Type': field2ofTask ,'Task Description': field3ofTask})
)


Hope this helps.

Sik

 

View solution in original post

Thanks, @v-siky-msft ! Your solution gave me a good start. Few of my fields are lookup fields, I took me a while to figure out how to patch LookUp field, but I did it. 🙂

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,074)