You need to sign in to do that
Don't have an account?
Code+1
Remove last three digits of Record ID
Hello All,
I am capturing the Record ID in a custom text field using a trigger.
I would like to remove last three digits from the Record ID captured in the field.
Please find the trigger below.
trigger captureID on Multi__c (before update) {
for( Multi__c mul : Trigger.new){
mul.Capture_Record_ID__c = mul.id;
}
}
For the Record - "a0f9000000AHZCr"
Value captured in mul.Capture_Record_ID__c = "a0f9000000AHZCrAAP"
I need to remove AAP from this field.
Please let me know how i should do.
Thanks !
I am capturing the Record ID in a custom text field using a trigger.
I would like to remove last three digits from the Record ID captured in the field.
Please find the trigger below.
trigger captureID on Multi__c (before update) {
for( Multi__c mul : Trigger.new){
mul.Capture_Record_ID__c = mul.id;
}
}
For the Record - "a0f9000000AHZCr"
Value captured in mul.Capture_Record_ID__c = "a0f9000000AHZCrAAP"
I need to remove AAP from this field.
Please let me know how i should do.
Thanks !
String mulId = mul.id;
mul.Capture_Record_ID__c = mulId.substring(0,mulId.length()-3);
All Answers
String mulId = mul.id;
mul.Capture_Record_ID__c = mulId.substring(0,mulId.length()-3);
Thank You... Your code is working fine !!