You need to sign in to do that
Don't have an account?
mcc22
How to create new Contact (firstname & lastname) from Account.Name
Hello all,
We have orders with associated accounts being created as part of an integration with eCommerce and ERP.
It is essentially creating person accounts since these are consumers. Instead of enabling person accounts, I would like to create a new contact record using the data from the account where Account.Person__c = true (custom field created to designate consumer accounts).
This would be an easy PB but I'm having trouble setting values with the name fields. Any shared experience on how to "reverse-concatenate" Account.Name into Contact first name & last name?
Thanks in advance
We have orders with associated accounts being created as part of an integration with eCommerce and ERP.
It is essentially creating person accounts since these are consumers. Instead of enabling person accounts, I would like to create a new contact record using the data from the account where Account.Person__c = true (custom field created to designate consumer accounts).
This would be an easy PB but I'm having trouble setting values with the name fields. Any shared experience on how to "reverse-concatenate" Account.Name into Contact first name & last name?
Thanks in advance
Greetings!
Hope you find this (https://developer.salesforce.com/forums/?id=906F00000008vVvIAI) thread helpful while creating the formula to get firstName and Lastname from Account Name.
Kindly mark it as best answer if it helps so that it can help others in the future.
Warm Regards,
Shirisha Pathuri
All Answers
Greetings!
Hope you find this (https://developer.salesforce.com/forums/?id=906F00000008vVvIAI) thread helpful while creating the formula to get firstName and Lastname from Account Name.
Kindly mark it as best answer if it helps so that it can help others in the future.
Warm Regards,
Shirisha Pathuri
Please go through with below line of code
String AccountName = 'New Account MA';
if(String.isNotBlank(AccountName)) {
Contact con = new Contact();
if(AccountName.contains(' ')) {
con.FirstName = AccountName.substringBefore(' ');
con.LastName = AccountName.substringAfter(' ');
insert con;
} else {
con.LastName = AccountName;
insert con;
}
}
Hope this explanation will resolve your query. Mark it as the best answer if you find it helpful.
Thanks
Akshay
All the best