Here is code: trigger ProductTrigger on Product__c (before insert, before update) {
Schema.DescribeFieldResult F = Product__c.Description__c.getDescribe();
Integer lengthOfField = F.getLength();
List<Product__c> prList = new list<Product__c>();
for(Product__c pr: trigger.new){
pr.AddedDate__c=system.today();
if (String.isNotEmpty(pr.Description__c)) {
pr.Description__c = pr.Description__c.abbreviate(lengthOfField);
}
}
}
Aucun commentaire:
Enregistrer un commentaire