• Derrick Calderon
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 0
    Replies
I am using Tinderbox as my 3rd party contract proposal management software.

In order to create a document in TB, it has to reference a field from the Lead.  So If I want to send "Blah" Proposal, I will need to have "Blah" in a specified field prior to submitting the request to TB. TB will then select the template based upon the string in the specified field.

I need to clear the text of the field about 5-10 seconds after submitting the request to TB.  I have seen scripts out there that can help me with the delay, so I am not too worried about that, but I need to do something along these lines:

If Field contains text then wait 5 seconds and set the text back to nothing.

Here is what I have so far:
 
trigger ClearTempHook on Lead (before insert, before update) {
	//List<String> LeadNames = new List<String>{};
	for(Lead myLead: Trigger.new){
 		if((myLead.temp_hook__c=='c')){
            temp_hook__c == 'hello';
		}
	}
}

 
The code works fine in Dev Environment, but it wont deploy to production.

Here is the error:
LeadConvert; null, Details: Test coverage of selected Apex Trigger is 0%, at least 1% test coverage is required; Average test coverage across all Apex Classes and Triggers is 0%, at least 75% test coverage is required.

Here is the code:
 
trigger LeadConvert on Lead (after insert,after update) {
//Bulkified
	List<String> LeadNames = new List<String>{};
	for(Lead myLead: Trigger.new){
 		if((myLead.isconverted==false) && (myLead.Ready_to_Convert__c == True)){
			Database.LeadConvert lc = new database.LeadConvert();
            lc.setLeadId(myLead.Id);
            lc.convertedStatus = 'Qualified';
            //Database.ConvertLead(lc,true);
            lc.setDoNotCreateOpportunity(false);
            Database.LeadConvertResult lcr = Database.convertLead(lc);
            System.assert(lcr.isSuccess());
		}
	}
}

Can you assist?

Thank you

Derrick
I am using Tinderbox as my 3rd party contract proposal management software.

In order to create a document in TB, it has to reference a field from the Lead.  So If I want to send "Blah" Proposal, I will need to have "Blah" in a specified field prior to submitting the request to TB. TB will then select the template based upon the string in the specified field.

I need to clear the text of the field about 5-10 seconds after submitting the request to TB.  I have seen scripts out there that can help me with the delay, so I am not too worried about that, but I need to do something along these lines:

If Field contains text then wait 5 seconds and set the text back to nothing.

Here is what I have so far:
 
trigger ClearTempHook on Lead (before insert, before update) {
	//List<String> LeadNames = new List<String>{};
	for(Lead myLead: Trigger.new){
 		if((myLead.temp_hook__c=='c')){
            temp_hook__c == 'hello';
		}
	}
}