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
bikla78bikla78 

APEX Splitting up full name into First and Last

I have a field called Product.Name that contains the first and last name of an employeeI also have 2 custom fields called Product.FirstName and Product.LastNameHow can I create a trigger that automatically looks for a space in the Product.name field to place the first name in the product.firstname and product.lastname field when a new product is created?
WasulaWasula
Use the Trigger.New on the Insert event of your Product object.  Use the String class to find the space then parse the string.  Do a search in the apex code library http://www.salesforce.com/us/developer/docs/apexcode/index.htm for String.indexOf and that should get you started.