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
developer_forcedeveloper_force 

help needed in writing a trigger

can anyone please help me in writing a trigger which should populate some 'test' field to the Account name.

 

If its business account 'test' field should be populated to just 'Name'

If its Person Account  , 'test' field should be populated to 'FirstName+MiddleName+LastName'

 

Thanks

 

 

goabhigogoabhigo

I think this can be done using work flow field update?

I hope record type is PersonAccount and BusinessAccount, is it? If yes, then it can be done using WFR.

kiranmutturukiranmutturu

for copying the field values trigger is not required just create a formula field and give the formula as

if(($RecordType.Name=='Bussiness Account'),Name,FName& Lname)

developer_forcedeveloper_force

No,it cannot be created as a formula field because i need that field to be a lookup to contact  so that i can access contact fileds since we are using person Accounts. and i dont think Workflow field update can be defined for itt.

I just need a trigger to populate that 'test' field to the name based on the recordtypes

 

Thanks