Forum Academy Marketplace Showcase Pricing Features

[Resolved] Current User's Email as a thing

So, I asked this question:

When the user clicks Add Job I save a bunch of details in the JobDetail table. One of the items I want to save is “JobAddedBy” currently it’s set to Current User. I was hoping it saves the current user’s email. However it doesn’t. When I try to use dynamic filed and say Current User’s Email… it expects further statement.

Whilst on the same page, I can display (only in test mode) the Current User’s email - I can add that to the DB… am I missing something basic here?

The reason I want to save the user’s email is, so if I ever want to delete the whole user or run some queries / build features, I want to have the email id of the current user to query on in the JobDetails table.

Here’s Emmanuel’s reply:

it’s because JobAddBy is of type user, while an email is a text. if you want to save the email, which i don’t recomment, you should use the user, make it a text.

1 Like

If you created a JobAddedBy field on the JobDetail type and you store the user that created it there, all you have to do is get Job’s JobAddedBy’s Email

This way if the user’s email changes, you always get the proper copy.

The system takes care of removing the user from the job if you delete it etc. If you want to delete the user, get the user’s email then search users by that email and delete the one that matches. Voila!