Activity › Forums › Salesforce® Discussions › How to extract the file extension into an custom field? Tagged: Extension, File, Salesforce Custom Field Salesforce® Discussions How to extract the file extension into an custom field? Posted by Tanu on July 20, 2016 at 2:16 PM How to extract the file extension into an custom field? Shekhar Gadewar replied 9 years, 9 months ago 3 Members · 2 Replies ExtensionFileSalesforce Custom Field 2 Replies Abhinav Member July 21, 2016 at 8:56 AM Hi Tanu, Here is the sample code :- List<Attachment> attach = [SELECT Name FROM Attachment]; for(Attachment a : attach){ String nameField = a.Name; if(nameField.Contains(‘.’)) system.debug(nameField.substringAfter(‘.’)); } I hope this helps. [adinserter block='9'] Shekhar Gadewar Member July 21, 2016 at 1:06 PM Hi Tanu, U can try : lastIndexOf() function Log In to reply. Public All Members My Connections Only Me PublicAll MembersMy ConnectionsOnly Me Public All Members My Connections Only Me