Business Rule question

MStritt
Tera Guru

I've created a Business Rule that will select a specific value in a choice field (dropdown with None) if another field is checked. It works. But if I uncheck the box, the choice remains. Doesn't return to None. 

 

When to Run:

Field Name is true

 

Actions:

Field Name To 'Requires Approval'

1 ACCEPTED SOLUTION

James Chun
Kilo Patron

Hi @MStritt 

 

You will need to explicitly specify what the BR should do when the Field Name is false.

It won't just do the opposite when the condition is not met.

 

You can either create another BR with something like when Field Name is false -> Field Name to 'None'

 

Or modify your existing BR with some script. When to run will be when Field Name changes and the script will be something like:

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

	// Add your code here
	if(current.getValue('your_check_box') == true)
	{
		current.setValue('your_field_name', 'requires_approval');
	}
	else
	{
		current.setValue('your_field_name', '');
	}

})(current, previous);

 

Cheers

View solution in original post

3 REPLIES 3

James Chun
Kilo Patron

Hi @MStritt 

 

You will need to explicitly specify what the BR should do when the Field Name is false.

It won't just do the opposite when the condition is not met.

 

You can either create another BR with something like when Field Name is false -> Field Name to 'None'

 

Or modify your existing BR with some script. When to run will be when Field Name changes and the script will be something like:

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

	// Add your code here
	if(current.getValue('your_check_box') == true)
	{
		current.setValue('your_field_name', 'requires_approval');
	}
	else
	{
		current.setValue('your_field_name', '');
	}

})(current, previous);

 

Cheers

haha beat me to it!

Naomi5
Giga Guru

How about...

When to Run:

Field Name changes

 

Script goes something like

If field name = true; then field name2 == "requires Approval"

else; then field name2 == ' ';

 

??