Skip to main content
Hi Guys,

I've got in my Org two custom objects: Event__c and Registration__c. Basically users can register for an event but the thing is that one user should do it only once for the event and reservation can't be made in future and at events data/time.

I was fighting with the trigger to resolve that problem but unfortunately my Apex and SOQL lack of knowllege succesfully stoped me. So I ask if anyone could help me.Hi Guys,

I've got in my Org two custom objects: Event__c and Registration__c. Basically users can register for an event but the thing is that one user should do it only once per event and reservation shouldn’t be made in the past and at the events data/time.

I was fighting with the trigger to resolve that problem but unfortunately my Apex and SOQL lack of knowledge successfully stopped me in this task completion. So I ask if anyone could help me.

Simplified structure of objects is shown below:

Event__c

_____________________

Event_Type__c    Picklist            

Event_address__c    Text Area            

CreatedById    Lookup(User)                    

Event_Date__c    Date/Time            

Name    Text(80)                           

LastModifiedById    Lookup(User)            

OwnerId    Lookup(User,Group)            

Registration__c

_____________________   

Name    Auto Number           

CreatedById    Lookup(User)           

Event__c    Lookup(Event)            

LastModifiedById    Lookup(User)           

OwnerId    Lookup(User,Group)           

In theory I would check if combination of Registration__c.OwnerId with Event__c.Id already exists in all records of Reservation__c object and if Event__c.Date is not Now or in the past (before insert, before update).

 

Simplified structure of objects is shown below:

Event__c

_____________________

Event_Type__c    Picklist            

Event_address__c    Text Area            

CreatedById    Lookup(User)                    

Event_Date__c    Date/Time            

Name    Text(80)                           

LastModifiedById    Lookup(User)            

OwnerId    Lookup(User,Group)            

Registration__c

_____________________   

Name    Auto Number           

CreatedById    Lookup(User)           

Event__c    Lookup(Event)            

LastModifiedById    Lookup(User)           

OwnerId    Lookup(User,Group)           

In theory I would check if cobination of Registration__c.OwnerId with Event__c.Id alredy exists in all records of Reservation__c object and if Event__c.Date is not Now or in the past (before insert, before update).
15 件の回答
0/9000