How to store User Input task ID in db?

Certified Senior Developer

I have a requirement where user A submits some task to user B for approval.

But I won't be able to use OOTB task report here for user B to accept that task for approval.

I need to provide a link to that task in my custom UI which opens that task.

I know processTaskLink() and task ID is needed and we can store that in our db and then query the task ID associated with that record to generate the link to task for that record for approval.

But, I am not able to figure out that how can I store the user input task ID to my db once it's active, if I put write to ds before then UI task is not active yet so no value and there is no point of putting after it as well because until unless task is completed by user that write won't run which doesn't makes any sense then. Because the link to open that same task will be generated after querying task id from db only.

Correct me if I am thinking wrong approach and suggest some way to achieve the above functionality, not to mention again, I can't use task report. Need to show the link to the task in custom UI.

  Discussion posts and replies are publicly visible