Announcement

Collapse
No announcement yet.

Websocket: Foreign field in Detail view.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Websocket: Foreign field in Detail view.

    Hi,

    If I want to see the updates on the detail view through WebSocket which contains the foreign fields, How can I do that?

    Example:

    Entity A contains a field X.
    Entities B and C have a foreign field X from Entity A.
    Now, under the B entity detail view, I will edit the field X.

    I want the updated value should be viewed under the entity C detail view without refreshing the page.

    I did the following

    PHP Code:
    use Espo\Core\WebSocket\Submission as WebSocketSubmission;
        protected function 
    afterUpdateEntity(Entity $B$data)
        {
            
    $this->getRecordService('A')->update($a->id$data);
            if (
    $this->getConfig()->get('useWebSocket')) {
                
    $socket = new WebSocketSubmission($this->getConfig());
                
    $socket->submit('newNotification'$this->getUser()->id);
            }
           
    // Other customization code.
        


    So, this will update the values in the entity A detail view. Not under entity C detail view.

    Why the WebSocket does not update the foreign field value in the detail view? Can anyone help me with this?

    yuri Can you please help me with this?
    Last edited by Ananya K; 07-22-2021, 05:13 AM.
Working...
X