Validate fields upon transition of workflow

Hi is there any way on custom script to validate fields to be input before approve the workflow
to make a pop up message approval to ask user to input the rest of missing fields

You could make these fields mandatory. Approval usually means the form gets submitted. So keeping the fields mandatory will ensure they are filled before submission.

The transitions are still happening despite the mandatory fields. by the way I made fields mandatory using client script. Any solutions ll be appreciated

You may need to refresh field or Form to make it mandatory.

The field has become mandatory but the form can still go to the next workflow state even without filling the mandatory field

The solution, adding field conditions in the workflow transition will help.
Thank you for support.

1 Like

could you please explain how to achieve this?

Where do you face the problem exactly?

@Aswin_AS I need a workflow where in an employee is created and saved.
After that the state changes to ‘create some profile’ which is assigned to some other agencies.
Then once they create that particular profile no. of that employee, they’ll then enter its ID no. in the field which has to be mandatory at the time of creating the profile (workflow section), previously while creating an employee, the field is not to be made mandatory.

Use client script to make the field mandatory with a condition Example :
if(frm.doc.workflowstate==’'Create some profile")
{
frm.set_df_property(“filedname”, “reqd”, 1);
},
This might help,
Alternative way is : use “Mandatory depends on” property of the field to write condition

Thank You!
Will try this.
However I got a work around for this - the way which I have setup the workflow is such that whenever the document.field is blank the ‘Action item’ does not show at all.

2 Likes

hi can i ask how did u acheive that one where the approve button doesn’t show unless the fields are all filled

@John_Dagpin in the ‘Transition Rules’ table go to conditions and put a simple python code snippet checking the field value is blank or not like -

doc.field_name != None and doc.field_name != ""

and its done!

still if you find is difficult to achieve, we can do a screen-sharing session through Google Meet in order to configure this Workflow condition as per the requirement.

2 Likes