I am creating a custom DML Log in our Salesforce sandbox, and I created a Class & method that fires based on an Apex Trigger Here's the class:
public class Util {
public static void logDmlDeleted(Sobject[] sObjList) {
DML_Log__c[] logInsList = new List<DML_Log__c>();
for (Sobject sobj : sobjList)
logInsList.add(new DML_Log__c(SObject_Type__c = sobj.getSobjectType().getDescribe().getName(),
Name__c = (String) sobj.get('name'),
SObject_Id__c = (String) sobj.get('Id')
));
insert logInsList;
}
}
The SObject_Id__c was an addition I added to record the Id of the sObject. It looks like this is working, except for the fact that there is an additional string of characters randomly appended: 'MAU'.
Here's a standalone sObject String Id:
a0HJ0000007yBdQ
And here is how that Id is written to the DML Log field:
a0HJ0000007yBdQMAU
How can I adjust the statement in the method so only the string's virgin Id is passed into the field?