function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Glen.ax1034Glen.ax1034 

contract activated signed how to tell if just got activated?

i am trying to detect if the contract just got switched to status: activated signed, and only run this code on the first activation... at present i had a checkbox that i thought would work by triggering true when this code is run but at present appears to be failing... in fact according to eclipse/force explorer there is no such field even though the custom field shows up on the salesforce field under contracts

 

presently running on contract (before update)

 

 

 

String rType; //declare string rType.
  //Use a for loop to run through The trigger Contracts and assign for every Case.AccountId a unique Contract.Id from the map
  List<Case> Cases = new List<Case>();
  for (Contract contract:Trigger.new){
   	if(contract.First_Activation__c == False) { //this is the first time the contract has been activated
    	if (contract.Status == 'Activated Signed') {
     		if(contract.Major_Product_Line__c == 'Background (BSG)' || contract.Major_Product_Line__c == 'Advanced Biometric/I-9 (ABG)' || contract.Major_Product_Line__c == 'Drug (Occupational Health) (OHG)') {
     			
        		if(maprtID_rtName.containsKey(contract.RecordTypeId)) //these are mapping the current contracts reference to recordtype ID to record type name
        			rType = maprtID_rtName.get(contract.RecordTypeId); //rtype is now the recordtypeID of the contract
     			if(rType == 'Application' || rType == 'Supporting Documentation' || rType == 'MSA - Master Service Agreement' || rType == 'Amendment' || rType == 'Standalone Agreement' || rType == 'Addendum') {
     	 			Case CaseAdd = new Case ();

 

 

my code at present, i cant even pull the field via SOQL:

 

SELECT First_Activation__c FROM Contract where ContractNumber='2012012680'

 

it errors: 

INVALID_FIELD:
SELECT First_Activation__c FROM Contract
^
ERROR at Row:1:Column:8
No such column 'First_Activation__c' on entity 'Contract'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.

 

and yet:

 

 

Contract Custom Field First Activation
 
Custom Field Definition Detail  
Field Information
Field LabelFirst ActivationObject NameContract
Field NameFirst_ActivationData TypeCheckbox
API NameFirst_Activation__c  
Descriptionused to detect if this is the first time the contract is activated for a trigger. it's to simulate a workflow rule: When a record is created, or when a record is edited and did not previously meet the rule criteria
Help Textused to detect if this is the first time the contract is activated for a trigger. it's to simulate a workflow rule: When a record is created, or when a record is edited and did not previously meet the rule criteria
Created ByGlen Bradford, 8/29/2011 10:24 AMModified ByGlen Bradford, 1/10/2012 2:33 PM
General Options
Default ValueUnchecked  
Field DependenciesField Dependencies Help 
No dependencies defined.
Validation RulesValidation Rules Help 
No validation rules defined.
Always show me fewerShow Fewer / Show Moremore records per related list