Try ERPNext Buy Support Partners Foundation

Server Side Script UPDATE value in other doctype

I have created a new doctype called Test with three fields test_code, test_name, status

Now when Create a new project in Project doctype i need to insert it to Test doctype
So I have created a new server script after save as below

frappe.get_doc(dict(
                doctype = 'Test',
                test_code = doc.name,
                status = doc.status
            )).insert()

And it worked Sucssfuly

after that create a new server script Before Delete

frappe.get_doc(dict(
                    doctype = 'Test',
                    test_code = doc.name,
                    status = doc.status
                )).delete()

also that worked

Now I need a server script to update or change the value For Example: when chang status in Project doctype I want to update status in Test doctype where test_code=doc.name

How I can do that?

Have you tried hooks?
https://frappe.io/docs/user/en/guides/basics/hooks

An on_update hook for Project doctype could work.

Try it.

thanks @Jitendra_Rathod
I can do that in Server script doctype or in .py file?

yes, you can do in .py file.

I won’t do change in files, is there any way to do it in Server Script as I did with insert and delete?

add your custome script and pass the path in hooks.py

How i can do that?

Try this code

value = frappe.db.get_value(doctype, docname, fieldname)
frappe.client.set_value(doctype, docname, fieldname, value)
or this
doc = frappe.get_doc(doctype-name, document-name)
// get property
doc.title
// set property to the document
doc.first_name = ‘My Name’
// save a document to the database
doc.save()