Hello !
I'm still discovering Power Apps and here I am facing a problem ...
I am using the Collect function to create a new line in my SharePoint list when a button is pressed. In this Collect, I fill in 2 fields:
- StepName: "TestTemplate
- FK_ProjectId: LastId
StepName is of type Text.
FK_ProjectId is a reference to another SharePoint list and it expects a Record.
I also create a LastId variable which corresponds to a Record (the one that will be used to fill FK_ProjectId)
Collect (
ProjectSteps;
{
StepName: "TestTemplate";
FK_ProjectId: LastId
}
)
Result?
Creating an entry in my SharePoint ProjectSteps list with as StepName "TestTemplate" (normal) but the column FK_ProjectId remains empty ...
Why ?
I absolutely can not find it and I leave it to you!
The final goal?
I have a model table containing steps (step 1, step 2, step 3 ...) and I will like to create new lines in my project table (ProjectSteps) of the form ProjectId + step 1, ProjectId + step 2 , ProjectId + step 3 ...
Thank you 😉
PS : my last screen https://imgur.com/a/Ao2cRYx
Solved! Go to Solution.
When you are trying to set a Lookup column in your list, you need to provide it with a record with the Id and Value of the item you are looking up.
I would consider the following formula to replace your current:
With({_lastRecord:
Patch(ProjectSummary; Defaults(ProjectSummary);
{'Project Manager': User().FullName}
)
};;
Collect(ProjectSteps;
{StepName: "TestTemplate";
FK_ProjectId : {Id: _lastRecord.ID; Value: _lastRecord.'Project Manager'}
}
)
)
This will reduce the variables and will provide what you need.
Also, the assumption in the above is that your Lookup column in SharePoint was defined to lookup to the ProjectSummary list and link to the Project Manager column. If not, adjust accordingly.
I hope this is helpful for you.
When you are trying to set a Lookup column in your list, you need to provide it with a record with the Id and Value of the item you are looking up.
I would consider the following formula to replace your current:
With({_lastRecord:
Patch(ProjectSummary; Defaults(ProjectSummary);
{'Project Manager': User().FullName}
)
};;
Collect(ProjectSteps;
{StepName: "TestTemplate";
FK_ProjectId : {Id: _lastRecord.ID; Value: _lastRecord.'Project Manager'}
}
)
)
This will reduce the variables and will provide what you need.
Also, the assumption in the above is that your Lookup column in SharePoint was defined to lookup to the ProjectSummary list and link to the Project Manager column. If not, adjust accordingly.
I hope this is helpful for you.
Thank you it works!
Have a nice day!
User | Count |
---|---|
257 | |
110 | |
97 | |
52 | |
39 |