Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

I've got a field update that saves prior value from a lookup to user object. The updated field is then used in email notification. It used to something like PRIORVALUE(ME1__c), but that would just save user ID. However, I want recipient to be able to see the actual user name.

I have tried PRIORVALUE(ME1__r.name) - Error: Field name does not exist. Check spelling.

and PRIORVALUE(ME1__r.firstname) - Error: The PRIORVALUE function cannot reference the me1__r.firstname field.

Any ideas?

share|improve this question
    
just to check, ME1__c is a lookup field on a custom object, to a user object? –  Simon Lawrence Jun 17 at 11:19
    
That is correct. Edit: it's a lookup field on a standard account object, if that changes anything. –  dzh Jun 17 at 11:19
    
If the workflow is on the ME1 object, you won't be able to traverse this relationship in a formula (ie.field update new value). I think I see what you are trying to do though... this fires if the ME1 relationship is changed, right, so you can track the "PRIORVALUE" of that FIELD, but not dig into IT'S fields. Syntactically, you are looking at something like PRIORVALUE(ME1__r).FirstName - but that (of course) also will not work! You might be looking at having to use a trigger here.. –  Simon Lawrence Jun 17 at 12:40

1 Answer 1

up vote 3 down vote accepted

I think the best bet here is to create a formula field on your Account Object that holds the text of your ME1__r.FirstName field, which of course will track the changes in the ME1__r relationship, then when you need to fire your workflow off, use PRIORVALUE on the formula field.

So the new formula field (called Current_Name__c) on Account will hold:

ME1__r.FirstName

And then your workflow rule field update (to what I called Prior_Name__c) will set your target field to:

PRIORVALUE(Current_Name__c)

I have just whipped this out on a developer edition and it does what I believe you are after nicely.. So when I change the ME1__r field on my Account, the formula field (which can be hidden everywhere from sight) reflects the CURRENT name of the relationship, and Prior_Name__c (your target field) holds whatever the firstname of the user was before I made the change.

Is this any good for you? If you are out of fields/adverse to this solution, I think you will probably have to set sail on the Trigger ship :)

share|improve this answer
1  
Formulas are the way to go. Actually found previous admin had these set up, just didn't configure it correctly! –  dzh Jun 17 at 13:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.