0 best practice for saving/tracking Person 2 Eric Connor posted 9 Years Ago Hello - We've created a set tables of our own for workflow/volunteer protection purposes and are confirming that we are using correct fields for saving/retrieving. When saving Person records should we use: 1) PersonAlias.Id (same as Person.PrimaryAliasId) or 2) PersonAlias.AliasPersonId (Person.Id) We're curious if better to keep track of the Alias table record or to maintain the actual Alias Id for the person. I (think) I see both being used in Rock core code and am wondering if any pitfalls with one direction or the other. Or 3) should we be standardizing on the Guid because that is the easiest to get to via a workflow. For example --> {{ Workflow.Requester_unformatted }} Thanks for any thoughts around this - Eric
Scott Conger 9 years ago David, do you see an issue if our team decide to standardize on PersonAlias.Guid, instead of PersonAlias.Id? Two reasons: 1) Clearer to new developers, instead of saying with workflows use guid but with C# code use id. 2) A guid would never get mismatched. If a dev saves PersonAlias.Id but accidentally tries to retrieve directly from Person.Id, it might actually pull up a person. Most likely the wrong person but a person non-the-less. Meaning during testing, they might not notice a bug. If we save the guid as the foreign key, it will be immediately obvious, if they retrieve it incorrectly because that guid would never be associated with a person. It is 100% unique to that PersonAlias row. No person would ever have that guid. Meaning during testing, it would clearly fail.
David Turner 9 years ago I don't see any issues at all with using Guid, and those reasons make a lot of sense.
David Leigh 9 years ago Great answer David! This also helped me to get a better understanding of how the Person Alias process works, thanks.