You need to sign in to do that
Don't have an account?
Account Name is Null
Hi Expert,
In my trigger below, new Account is created when trigger happens on Appointment__c object:
In my trigger below, new Account is created when trigger happens on Appointment__c object:
if(Trigger.isInsert){ for(Appointment__c newRec : Trigger.new) { Account converted = new Account( LastName = UserInfo.getLastName(), FirstName = UserInfo.getFirstName(), ABN_ACN__c = newRec.ABN__c, Entity_Name__c = newRec.Legal_Entity_Name__c, Trading_Name__c = newRec.Business_Trading_Name__c, Owners__c = newRec.Owner_s__c, ); System.debug('long converted.Name' + converted.Name); newRec.Legal_Entity_Name__c = converted.Name; lstAccounts.add(converted); } upsert lstAccounts; }This problem is that converted.Name is Null. As i know, when First Name and Last name are populated for an Account then Account.Name should be populated also. Pls show me the way to fix this issue?
Assuming you are using person Accounts,
The Name field is populated only after the DML runs on the Account. you can't get it in the debug log.
All Answers
For an Account Field, name is the text field which is not derived, we need to assign the value, where as for user name is derived from first name and last name, not for an account.
Regards
Sampath Kumar Goud
Assuming you are using person Accounts,
The Name field is populated only after the DML runs on the Account. you can't get it in the debug log.
To get the name of the account you need to fetch the record
Use SOQL in after Insert context.
Let me know if you have any question.
Please mark this as solution if this solves your problem, So that if anyone has this issue this can help