Hi!
I'm trying to connect a certain ID to a new message. the idea is when an employee clicks to start a new conversation with a company, that the chat gets started with an employee who works at that company.
I've tried connecting with an SQL query but can't seem to get it right. does anyone have any ideas?
I want to avoid rearranging my database.
Thanks for the suggestions, I fixed it myself :)
Was overlooking my work, noticed i missed a refresh and an extra assign.
Hi @Elsa Mouwes
Try to add one more time USER source and rename as sender and add the MESSAGE entity and put the joins as
Sender.id = message.sender
Then try to add a source again which would be CONVERSATION and joins would be
Conversation.id = message.conversation I'd
Now for receiver as you said receiver would be company add one more time COMPANY entity source and rename as receiver joins would be
Receiver.id= message.reciever
And when you open a chat screen and you want to fetch only the chat between logged in user. Just put the filter for
Message.reciver=companyID
Message.sender=getuserid()
I hope by applying these filters it will work let me know if it works or not I will help you more.
Thanks
Prince
Hi Prince,
I do not exactly understand what you mean. as a variation I've added a User data source that is joined with userprofile, company and supplier. with a filter that is company.id = companyID. then i set the message.recipient as the data source's user.id.
however, this is creating a conversation and message, but setting the recipient user id on 0
try to attach your oml i will check n will try to fix it ASAP.
Regards,
sorry for the late answer, here are my files. For clarity, the idea is that if you click on "start a conversation" at a supplier's profile as a company1 employee, that you start a conversation with an employee of that company.
HI Elsa,
The user will have always a company,
ensure that the user profile has the company field filled.
Related to supplier company entity the supplierid as you have in the join(inner join) must be filled.
Either provide for that user company a supllier, or change the inner join to left join between company and supplier entities.
Hope that helps you