Read Only document once Approved for an unsubmitted document

Hi,

I am trying to make the following workflow for material request as below

Creator CM > Approved By PM > (Creator Read-PM Read/Write) > Approved by QS > (PM Read -QS Read/Write) > Approved by PC (QS-Read-PC Read/Write/Submit) Approved by Director (Approve/Review) > Procurement create Purchase Order

Creator > Rejected By PM/QS/PC > Creator able to edit the document

Users Legends:
CM - Construction Manager
PM - Project Manager
QS - Quanitity Surveyor
PC - Project Coordinator

Best Regards

Maverick

@zeeshan_shafqat

you have to write script for that, check your current workflow state and Login user role and set the form read only or editable.

if (cur_frm.doc.workflow_state == "Approved By PM" && 
user_roles.indexOf("Construction Manager")!==-1) {
	cur_frm.set_read_only();
}
4 Likes

Thanks Sangram,

Can you advise where to implant this script, will it be going somewhere in the Material Request Document.

Regards

Xeeshan Shafqat

@zeeshan_shafqat

Do not add this in Material Request Document. Write Custom script for that,
Check this one - Custom script examples

Ok I will try it and update you, if it works although I am not that tech savy in codes but hopefully with your guidelines i will manage it

Regards