ERPNext Foundation ERPNext Cloud User Manual Blog Discuss Frappé* Donate

How can you fetch the one who approved/submits?


#1

Good day! How can you fetch the one who approved/submits the file?

I have 3 workflow state which are:
Pending Request
Pending Approval
Approved

I have tried using the following:
Pending Request = doc.owner
Pending Approval = doc.modified_by
Approved = doc.modified_by

However the problem with the approved = doc.modified_by is that you need to save it first before you submit the file for it will not change the modified_by name. Is there a way to fetch the one who submit? like doc.submitted_by?

Thank you hope you get my case.


#2

you can enable track changes fields from DocType to track the document.

if you want submitted_by then you have to customize that particular DocType.


#3

Thank you for helping me again however, my problem is like this

I have this 3 field where in 1 would only appear every time someone submits the file.

Workflow:

Draft -> Pending Request -> Pending Approval -> Approved

So what I did was when someone submits the draft to pending request it will fetch the doc.owner and put it on the “prepared by” field then once the manager views the file as pending request he/she will just click a button “submit” then it will fetch the doc.modified_by and put it on the “noted by” field, however the problem with doc.modified_by is that you need to change something/save it first before you submit it, for it will not change the modified_by is there a way to fetch this area?

Hope you get our case. Again thank you so much.


#4

To search the code try something like this
frappe@ubuntu:~/frappe-bench$ find . -name ‘*.js’ | xargs grep ‘changed value of’

That leads to this code here

To help with your learning best to check out the Version doctype.


#5

You mean you want to set these fields’ values with the users who carried out those operations ?


#6

Would gladly check this. Thank you!


#7

Sorry for I really don’t get your question however my case is that I would like to automatically fill those fields according to who created the file and who submitted the file.

Like:

Draft
Prepared By = Doc.Owner (Because he’s the one who created the file)

Pending Request
Noted By = Doc.Modified_by (Because he confirmed that the infos inside the file is correct and submitted it for approval)

Pending Approval
Approved By = Doc.Modified_by (He approves if the file is ready to be executed)

We just want it to automatically fill those signatories according to whoever submits the file to reduce errors like having someone use your name in the signatories.


#8

Yes I think so root13F, kelscey90 first you must learn how the current workflow is implemented in the code before you can perhaps customize it to work in your use case