how to make a field mandatory before it goes for approval using business rule

Kiran Dibakar
Kilo Contributor

trying to make field mandatory before user submits it before approval.
do not want to use client script or on dictionary level.

 

 

 

 

3 REPLIES 3

OlaN
Giga Sage
Giga Sage

Hi,

Using a Business rule can be done, but without a Client script or an UI policy the user will not have any indication that that field is mandatory.

So it might not be the best user experience, to have an error message stating invalid insert, without first showing which field should be filled in.

To make a field mandatory with a business rule you can write something like below example.

(and this simple example doesn't even need to use script, it could be done with conditions filter and actions alone.

Business rule runs before insert

(function executeRule(current, previous /*null when async*/) {

	if (!current.getValue('description')) {
		gs.addErrorMessage('Description is mandatory, cannot be empty');
		current.setAbortAction(true);
	}

})(current, previous);

 

Kiran Dibakar
Kilo Contributor

hi Olan,

 

how can I add this condition in if --> my field1 contains some value and field2 is checked then only proceed or else stop the action with some message.

Hi, sorry for the late response.

Can you please elaborate what you mean?

If I understand you correct, you can with a Regex perform validation that the text entered matches some given pattern.