+ Start a Discussion
Derrick CalderonDerrick Calderon 

Update a custom field

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';
		}
	}
}

 
Derhyk Doggett -Derhyk Doggett -
Hi Derrick,
Using a future call out should help you out here. 
Change your trigger events to occur after and put an update to the lead in a future call. 
More details can be found here:
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_future.htm

Hope that helps. 

-Derhyk
JAY_PJAY_P
Try this code and let me know its working or not ??/
trigger ClearTempHook on Lead (before insert, before update) {
   List<String> LeadNames = [SELECT ID , NAME FROM Lead (yourobjectname__c) ];
	for(Lead myLead: Trigger.new){
  		if((myLead.temp_hook__c=='c')){
            temp_hook__c == 'hello';
          update mylead; 

		}
	}
}