microsoft / microsoft/Power-Fx
ThisRecord seems to switch context.
@jas-valgotar is already working on this.
Since Nov 9, 2023.
- Dominant language
- C#
- Stars
- 3.4k
- Forks
- 358
- Avg merge
- 10h 34m
- Merged PRs (30d)
- 3
Description
I am trying the new Dataverse low-code plug-in and running into maybe an issue or maybe a misunderstanding of PowerFX.
This is an instant plug-in that runs on the creation of a record in a new custom table table.
The table will have an email address field (text).
The use case is an application form, and determining if the applicant already exists as a contact in Dataverse.
I want to query the Dataverse contact table to see how many times that email exists.
For an instant plug-in, I have the code CountIf([@Contacts], Email = ThisRecord.Email), however the ThisRecord object seems to now want to reference the Contact table (the dot notation shows contact table fields), and not the table that is used to trigger the plug-in.
If I hard-code the ThisRecord (e.g. ThisRecord.abc_emailaddress) I get an error.
Just curious if this is an issue, or just how the ThisRecord object behaves?
Here is the full code - the CountIf always returns the number of contacts (email = email).
Switch (
CountIf([@Contacts], Email = ThisRecord.Email),
1, Patch('Volunteer Applications',ThisRecord,{'Existing Contact ': 'Existing Contact'.'Single match found'}),
0, Patch('Volunteer Applications',ThisRecord,{'Existing Contact ': 'Existing Contact'.'No match found'}),
Patch('Volunteer Applications',ThisRecord,{'Existing Contact ': 'Existing Contact'.'Multiple matches found'})
)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.