Click here to Skip to main content
15,922,533 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
Hi,
I have to implement a feature in our web application to capture the user action like approve/reject from email to database.

Planned to trigger the email through scheduled job which contains Approve/Reject link or button. The user action needs to be captured in database.
Once the user clicks on the action,it should not work for the second time.

Could you please suggest me on how to achieve this feature implementation??


TIA,
Vaithi

What I have tried:

As this is a new feature implementation, Currently in a analysis stage.Below I have mentioned the planned idea and requirements.

*Mail triggered through batch job(No doubts in this have experience in creating a batch job).
* Email with link.
* User action needs to be captured in database using api endpoints (planned, but will go with the different approach if implemention is easier than planned).
Posted
Comments
Graeme_Grant 20-Mar-24 1:49am    
Are you asking us to design your database table for you?
Vaithilingam Alagappan 20-Mar-24 1:57am    
Hi Graeme_Grant,

I'm asking for coding approach.

Thanks
Graeme_Grant 20-Mar-24 1:59am    
Ok.. We're not here to do your work for you, we are here to offer advice to help you with your code.

However, if you want someone to write code for you, then there are these services:
* fiverr[^]
* Upwork[^]
* Freelancer[^]
* Guru[^]
* PeoplePerHour[^]
* TaskRabbit[^]
* Karat[^]
Vaithilingam Alagappan 20-Mar-24 2:03am    
No I'm not asking to do my work.
I'm asking for an approach or idea which I can implement in my application.

Quote:
No I'm not asking to do my work.
I'm asking for an approach or idea which I can implement in my application.

The concept would be to have the following in a table in your db:
* user Id
* Job Id (Guid) used in the link for the email
* Job Type for designating the job to be run
* Execution date & time
* Job executed is a boolean to identify if the job was done / email sent
* Response type - accept/declined
* Response date & time

All dates/times should be UTC-based.

How you implement the job scheduler and email system is up to you. There are many libraries out there for you to choose from.
 
Share this answer
 
It's not entirely clear what you're doing or even how this email is sent or what you expect to happen when the user gets the email.

But, generically, if the user has to approve something on a website, you would include a link in the email that opens a URL in a web browser, possibly with all the data in the URL to identify the user or record in a database that the user has to approve.
 
Share this answer
 
Comments
Graeme_Grant 20-Mar-24 18:11pm    
I have already suggested a job I'd for the link Uri sent in the email. So your suggestion is already covered.
Quote:
Once the user clicks on the action, it should not work for the second time.


Based on this it seems that you already check and save the record with a true/false returned value. It further seems that when a user clicks on the link/button a second time, it should not do anything as the value has already been captured??

So, as a wild guess based on the little information given, ensure you have a field in your table that does the the checks - "has the user clicked the button", if yes, disable the button/link if mail is sent a second time around, if not, enable button/link for user to click on...
 
Share this answer
 
Comments
Graeme_Grant 20-Mar-24 18:10pm    
In my suggestion I have a response type, so if set, then you would not accept a second response. So your suggestion is already covered.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900