28
Views
6
Comments
Solved
Message recipient where company = companyId
Question
Application Type
Reactive

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.





Screenshot 2023-12-22 at 18.27.07.png
Screenshot 2023-12-22 at 18.29.43.png
Screenshot 2023-12-22 at 18.30.28.png
Screenshot 2023-12-22 at 18.30.15.png
UserImage.jpg
Elsa Mouwes
Solution

Thanks for the suggestions, I fixed it myself :)

Was overlooking my work, noticed i missed a refresh and an extra assign.

2024-05-08 06-29-37
Prince Aadil Khan Panwar

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

UserImage.jpg
Elsa Mouwes

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

Screenshot 2023-12-29 at 17.14.54.png
Screenshot 2023-12-29 at 17.15.20.png
Screenshot 2023-12-29 at 17.15.13.png
2024-05-08 06-29-37
Prince Aadil Khan Panwar

try to attach your oml i will check n will try to fix it ASAP.

Regards,

Prince

UserImage.jpg
Elsa Mouwes

Hi Prince,

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. 



SupplierPortal_DB.oml
SupplierPortal.oml
UserImage.jpg
Alexandre Yip

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 

UserImage.jpg
Elsa Mouwes
Solution

Thanks for the suggestions, I fixed it myself :)

Was overlooking my work, noticed i missed a refresh and an extra assign.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.