Jump to content
Salesforce and other SMB Solutions are coming soon. ×

Internal Mail


odedd
 Share

Recommended Posts

Hi all.

I'm trying to create an internal mail system. I have a table of users, and a table called "Internal Mail" which will hold all the messages.

Every message has the following fields:

- MessageID (auto-number)

- FromUserID

- ToUserID

- CCUserID

- BCCUserID

- GroupID (each user is part of a group, so this is to enable sending a message to a user by its groupgroup of users)

- Subject

- MessageBody

 

My problem is this - Once a user logs in, I want him to see all the messages he recieved in a portal. However I can only make a relationship based on more than one connection using "AND". Is there a way to define a relationship based on an "OR" connection (something like: ToUserID = UserID OR CCUserID = UserID Or BCCUserID = UserID etc...) or am I thinking about this all in a wrong way?

Link to comment
Share on other sites

One more thing, I don't know if it's relevant:

ToUserID, CCUserID and BCCUserID are all repeating fields (to allow sending to more than 1 user)

Link to comment
Share on other sites

From what it sounds like, you are looking at a one-to-many relationship. In which case, I would recommend having tables as below:

 

Table MESSAGE

msgID (auto-serial)

msgSenderID (only record the sender)

msgMessage (actual msg)

 

Table RECIPIENT

rcpID (auto-serial)

rcpToID (for To's)

rcpCCID (for CC's)

rcpBCID (for BC's)

rcpCalcID (run a calc here as follows:

if (rcpToID""; rcpToID;

if (rcpCCID""; rcpCCID;

if (rcpBDID"";rcpBDID;"")))

 

Note that only one of the 3 'To' fields would be used in any given recipient record. Either the user was directly addressed as a 'to', or was 'cc'd' or was bcc'd. The calc field simply gives you a field to base your portal on, as it will list the ID no matter which of those fields it shows up in. So then you can have a portal based on RECIPIENT using the rcpCalcID field to match your contact to any msgs sent to them. You could then do another portal based on MESSAGE that you would match with msgSenderID to show all the msgs that user has sent.

 

Hope that makes sense...

Ryan

Link to comment
Share on other sites

This thread is quite old. Please start a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



×
×
  • Create New...

Important Information

Terms of Use