override qualify button in leads

Hi Community,

 

I want to override qualify button method in Leads section and check if some of the fields have appropriate value. If not, I want to stop the lead qualification process. Can someone help me in achieving the same?

Thanks,

Gokul

 

 

Like 0

Like

5 comments

Hi Gokul,

 

As I already stated here the method that is called upon the "Qualify" button click is onLeadManagementButtonClick (for the LeadPageV2 module).  In the LeadSectionV2 the method is onLeadManagementSectionButtonClick. You can override both methods in the replaced modules: in LeadPageV2 you can add additional this.get(Column)!= check and then call parent method and in the LeadSectionV2 you need to get ActiveRow and perform an ESQ select query to check if the record by ActiveRow has the data needed to start the process.

 

Best regards,

Oscar

Oscar Dylan,

Thank you  for the reply. In case of section page as told I am running an esq. How can i call parent method based on execution of esq?

onLeadManagementSectionButtonClick:function(){
	activeRowId = this.get("ActiveRow");
	var esq = Ext.create("Terrasoft.EntitySchemaQuery", {
		rootSchemaName: "Lead"
	});
	esq.addColumn("Id");
	esq.addColumn("Account");
	esq.addColumn("Email");
	esq.getEntity(activeRowId, function (result) {
		if (result.success) {
			var account = result.entity.values.Account;
			var email = result.entity.values.Email;
			if(account==='' || email==='')
			{
				Terrasoft.showErrorMessage("error msg");
			}
			else
			{
				//call parent method
				this.callParent(arguments);
			}
 
	  }
	}, this);
},	

 

S Gokul Aditya,

 

ESQ is asynchronous so you won't be able to call the parent method. But we can do it in another way. Try this code:

onLeadManagementSectionButtonClick: function() {
				var gridData = this.get("GridData");
				var activeRow = this.get("ActiveRow");
				var activeRowGridData = gridData.get(activeRow);
				var activeRowGridDataAccount = activeRowGridData.get("Account");
				var activeRowGridDataEmail = activeRowGridData.get("Email");
				if (!activeRowGridDataAccount || !activeRowGridDataEmail) {
					Terrasoft.showErrorMessage("error msg");
					return;
				}
				this.callParent(arguments);
			}

But in this case you will have to display both account and email columns in the lead section grid:

This approach works on my side, should also work on your end.

 

Best regards,

Oscar

Oscar Dylan,

thanks for the quick reply. I have few more such fields to be checked. Can it be done without adding columns to the section grid?

S Gokul Aditya,

 

Not sure, the code should be debugged to find out the proper way of the customer's business task completeness. I just gave an example, the final implementation can differ.

Show all comments