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
SteveSlimerSteveSlimer 

Contract Number Based on other Required Fields

We currently use another system to book our contracts.  Force.com uses their own contract number and we would like to use our contract number as the primary key for the contract. 

 

Since our contract numbers are based on some of the required custom fields that we built, I was wondering how it could be coded in APEX.  I have pseudo code already written.

 

 

Class:
public class ContractNaming {
  public static void addContractNaming(Contract[] contractnaming) {
    for (Contract a.Name) {
      if (a.Name != '0')
        a.Name = (Concantenate {!Account.Global_Customer_Number__c},
          {!Contract.Contract_Master__c}, {!Contract.Contract_Rider__c},
          {!Contract.Contract_Customer_Number};
      }
   }
}



Trigger:
trigger contractNumberTrigger on Contract (before insert) {
  ContractNaming.addContractNaming(Trigger.new);
}
    

 

Does anyone have an suggestions