Custom script after created new user

Hi guys,

How can i achieve something like this scenario : Admin created new user : xxx@gmail.com , password : xxx, after it created, i want to trigger external web service to insert new user record to other database, where can i add/edit this code ?
Creating new user isn’t a doctype ? i can’t find where is it the location of Setup-> User -> New …
Your help is greatly appreciated

regards,
Jacob

If you are using a custom app, use hooks.py

See erpnext’s hooks.py:

how can i retrieve core module field value (newly created/submit) in hooks.py ?

you can call

after_insert

hook funcion so you will get current doc object so you can manipulate data and trigger your web services.

“after_insert” : “doctype method”

is it something like this ? but how can i get the newly created record in that method ? i search some is using frappe.db.get_value(“User”, … , …) => i do not know how to retrieve the newly created record ~

i know there is a way to use frappe.sql to retrieve the top id, but this isn’t effective… Could anyone please share how can i do it ?

please check above image and its path to method it is defined like

def test(doc, method):
   //doc is current object here

Thank you. I able retrieve newly created user , but able to get the password, it show blank when i print it out on web browser console. How can i retrieve the password from python ?

get_password('something attribute') try with this

I tried with like this =>

but isn’t get the password that user just created this :
image

The error was :

image

check with field name that you are passing to

get_password

it is correct~

Can anyone please kindly guide me on how to retrieve the following User doctype newly created password from python ?

image

I try with doc.get(“new_password”) , the result is blank, when i try doc.get(“email”), it shows email address of the newly created user. However, if i use doc.get_password(“new_password”), the error will hit :

image