Based on drop down show error

Hi all,

I have two dropdown in the leads those are Payment_status_c, lead_status
if payment_status_= “pending” and lead_status=“new” then it has to show error" please check the payament is not completed".

any help here.

I assume that yu want to achieve this in the Edit View.

In that case your best choice will be a Logic Hook, for which you need some programming knowledge.

I suggest thta you read the developers guide in the logic hooks section.
You may also consider using this:
https://github.com/audoxcl/SugarCRMLogicHooks

Additionally you may create a report to show you all those records with the “error” (I would rather say “invalid” instead!)

1 Like

is their any js for showing error based on the two combinational dropdown value s ??

In the logic hook you should inject (echo is enough) the following code (after you have modified it to suit your needs! This is only an example.):

function compareDropDowns(){
  var a = document.getElementById("dropDownA");
  var b = document.getElementById("dropDownB");

  if (a.options[a.selectedIndex].value == b.options[b.selectedIndex].value) {
      // Do Some stuff
  } else {
      // Do other stuff
  }
}

function addOnChangeToDropDowns(){
  var a = document.getElementById("dropDownA");
  var b = document.getElementById("dropDownB");

  a.onchange = function() {compareDropDowns()};
  b.onchange = function() {compareDropDowns()};
}

addOnChangeToDropDowns();

You have to find out the ids of both your dropdowns before you do so. (You can just use chrome or firefox inspector).

You may also improve the logic to check that both Dropdowns hve been modified or you may do the check only when the save button is clicked or any other actions you require…

1 Like

class logic_hooks_class {

   this code is not working


function before_save_method($bean, $event, $arguments) 
        { 
			if(isconvert_c==1 && payment_status_c==1){
				trigger_error('payment is not done',E_USER_WARNING);
			}
		
        }

}

This code is not working any helps>>>
class logic_hooks_class {

function before_save_method($bean, $event, $arguments) 
        { 
			if(isconvert_c==1 && payment_status_c==1){
				trigger_error('payment is not done',E_USER_WARNING);
			}

}

}