Ask Search:
Clare HeathClare Heath 

Update a text field with the name of a related user on a case

Hi

Ok, have been battling with this one all afternoon.  Am sure I must be missing something simple!

I have built a process to update a lookup field (Agent Owner) on a case with the CreatedBy User ID. This works fine.

The lookup field is a replacement for an existing field (Agent Owner) which is 'Text'.  Because there is so much reporting and WFRs referencing the 'Text' field I want to continue to update that field but I do not want to show it on the page layout because I want to drive the behaviour to use the lookup field.

Does anyone know how I can update the text field with the 'Name' from the user record so it will stay in synch with the new lookup field?

Thanks
Clare
Best Answer chosen by Clare Heath
Ahilesh RagavanAhilesh Ragavan
Create a WFR on Case:

Evaluation Criteria:
Evaluate the rule when a record is created, and every time it's edited
Rule Criteria:
AND(
NOT(ISBLANK(Agent_Owner2__c)),
ISCHANGED(Agent_Owner2__c)
)
Add a field update on the "Agent Owner" text field like this:
Agent_Owner2__r.FirstName+' '+Agent_Owner2__r.LastName
I hope I got it correct this time !!
 

All Answers

Ahilesh RagavanAhilesh Ragavan
Hello Clare,

Update the text field in your process with this formula:
[Account].CreatedBy.FirstName +' '+[Account].CreatedBy.LastName

Note:Replace the object name in the formula.

User-added image
Clare HeathClare Heath
Aha - I knew there must be a way.  That will work for the cases when they are created by a user, however, we have a lot of cases coming in through email or web to case.  These cases are mannually allocated to an 'Agent'.
The person allocating the case will select the Agent in the look up field (so from the User object).  Do you know how I can keep the old field in synch with the manual updates and any subsequent changes?
 
Ahilesh RagavanAhilesh Ragavan
Is the Lookup(User) field(Agent) present in Case object?
 
Clare HeathClare Heath
I have 2 fields on the case object:

1. Agent Owner - this is a text field that has been used historically and is referenced in templates, reports etc.
2. Agent Owner2 - This is a lookup to the User object - I want to replace the above field with this one but don't want to break anything so I want to continue to update the text field with the name that has been entered in the Lookup field.

I have no idea why a text field was being used, it is a bit of a mess and very bad practice.  the system is totally over-complicated so it is going to be a bit of work to locate all the references to the old field and change them so I can get rid of it.  In the meantime I want to hide it so people are using the lookup field and we are driving the correct behaviour.

Hope that makes sense! :-)

Clare
Ahilesh RagavanAhilesh Ragavan
Create a WFR on Case:

Evaluation Criteria:
Evaluate the rule when a record is created, and every time it's edited
Rule Criteria:
AND(
NOT(ISBLANK(Agent_Owner2__c)),
ISCHANGED(Agent_Owner2__c)
)
Add a field update on the "Agent Owner" text field like this:
Agent_Owner2__r.FirstName+' '+Agent_Owner2__r.LastName
I hope I got it correct this time !!
 
This was selected as the best answer
Clare HeathClare Heath
Fantastic!!  Thanks so much I will go and try that but makes sense so I am sure it will work :-)
Clare HeathClare Heath
Works perfectly :-)