+ Start a Discussion
pradsy90pradsy90 

Validation rule for a reservation field

Hello Experts I have a requirement where I have to validate the ticket number for a reservation. The ticket numbers get assigned by a user. We want to make sure that the ticket number was not assigned to any other reservation record for the same show. So, essentially I would have to browse through all the reservation ticket nos for that show and check if it has not been assigned. How can I do this? Will I need an Apex class or just a complex set of formulaes? Any help is appreciated. Thanks in advance for your time Regards, Pradhip.S
Best Answer chosen by Admin (Salesforce Developers) 
SteveMo__cSteveMo__c

You can still do it, you just need to make your unique field a concatenated string that includes all of the elements.

 

Show+Date+Ticket

All Answers

SteveMo__cSteveMo__c

Which edition of SFDC are you using?

Tom87Tom87

For this you need to write some Apex class...or

 

if u have less number to seat then u can use flag..like u have 10 saet..in this we can use 10 flag..once seat is assign to any user...we can automatically update the flag....next time we can check if flag is false..user can select the seat...

SFDC_EvolveSFDC_Evolve

i think .. You are trying to stop the duplicate .   For that You need write the trigger .   Valdiation Rule wont work here  .. :)

 

Thanks

SFDC_Evolve

SteveMo__cSteveMo__c

If you're on EE or UE you could do something like this using a WFR and a Unique Field

atallatall

Check  the option "Do not allow duplicate values" under which check the radio button "Treat "ABC" and "abc" as duplicate values (case insensitive)" which doesnot allow the duplicates in this field and makes this field values unique.

 

Create the field "Reservation Ticket Number" under which perform the above actions

 

Please let me know whether we are on the same page.

pradsy90pradsy90

Hi -

 

Thanks for the reply. But this will not work for me. I think I ight have to write an APEX Class as suggested by some other people.

 

This will not work because I should be able to assign the same ticket numbers like ticket numbers (A1, B2, C3) for different shows for diff days.

 

So, I cannot make the ticket number field a unique field.

 

Regards,

Pradhip. S

SteveMo__cSteveMo__c

You can still do it, you just need to make your unique field a concatenated string that includes all of the elements.

 

Show+Date+Ticket

This was selected as the best answer
pradsy90pradsy90

Oh.. I did not know that a field in Sales Force can be made as unique for a combination of fields.

 

Can it be for a combination of fields where some fields are from the same object (Reservation_TicketNumber) and some from from other related objects like (Show_Number).

 

Or should they be all from the same object i.e. (Reservation_TicketNumber) + (Reservation_ShowNumber)

 

 Let me try this in any case.

 

Thanks.

 

Regards,

Pradhip. S

pradsy90pradsy90

All -

 

I wrote an APEX trigger and works like a charm. Thanks all for your help.