You need to sign in to do that
Don't have an account?
Update custom text with custom picklist value in User object
Hi,
I have created two custom fields in the User object.
FIELD1 is a picklist field
FIELD2 is a Text field of length 100.
I want to be able to search on the values in FIELD1, however i know that i can't search on a picklist value. As a result, I have created the text field FIELD2, which will be able to be search upon.
FIELD2 is invisible to the user.
I would like that when a user record is updated or created, they will select the correct option from FIELD1, which will then populate/update the hidden field, FIELD2.
People can then search on the FIELD2 field as if it was FIELD1, and select all the relelvant records.
I have tried to do this using a formula, however, this doesn't seem to update the record, and therefore, doesn't allow the field to be search on. I have also tried to do it using a workflow rule, however, there are no option to perform workflow on User object.....yet.
So i'm onto Apex, but am not a developer.
The code i have is this:
trigger FIELD1_Search_Trigger on User (before insert, before update) {
for (User obj: trigger.new){
FIELD2__c = FIELD1__c;
}
}
But this is giving the error:
Error: Compile Error: Variable does not exist: FIELD2__c at line 3 column 5
If anyone has any help they can offer me i'd be very appreciative!!
THanks.
Try this:
That's amazing thanks Boom!
So, the prob is that leads me onto another problem.... that trigger is now working perfectly and updating my field2, however, I'm still not able to type that value into search and have it return records based on it, even though it's now a text field.
Do you know if there is something more i need to do??
Many thanks,
Nick