You need to sign in to do that
Don't have an account?
RobR
Picklist Validation?
Hello, I am trying to validate a picklist. I would like the users to only be able to select the next value in the list.
e.g.
Picklist:
Stage 1
Stage 2
Stage 3
Stage 4
I only want the user to be able to select "stage 1" save the record, The only be able to select "Stage 2" save the record... ect.. Is this possible?
Thanks
If this is possible via a validation rule, it will be long, complicated, difficult to troubleshoot.
You should be able to do this fairly easily with a trigger. The following is air code; I did not actually try to compile it but it should get you started.
trigger CustomObjectTrigger on CustomeObject__c (before insert, before update) { for (Integer i = 0; i < Trigger.new.size(); i++ ) { if (Trigger.isInsert) if (Trigger.new[i].Stage != 'Stage 1') Trigger.new[i].Stage.AddError('Must Be created Stage 1'); if (Trigger.isUpdate) { if ((Trigger.old[i].Stage == 'Stage 1') && (Trigger.new[i].Stage != 'Stage 1' && Trigger.new[i].Stage != 'Stage 2') Trigger.new[i].Stage.AddError('Must Create Stages in Order'); etc, etc, etc } } }
Thank you very much for your reply. I have taken a look at your code but i'm new to SF, could you let me know where I would apply this?
Thanks