How to get loggedin user in form

how to get current logged in user in any forms field,…, what is the code guys ?

In JS use:


@kennethsequeira where to put this code buddy ? which place in the form ?

Can you elaborate on your use case?

@shadrak98 when i create a todo n then allocate it to someone else it goes to that user but its gets removed from my to-do list… so i have no idea how many todos i have created and givn to whom…

also users shall only be able to see their own todo’s or todos they have givn to others.

so i need to create a field in todo form with name assignor which will pull logged in user…

so this way when i select fliter assignor as me, i can see the list…

also its strange erpnext treats allocated to field as owner or created by,