How to push Contacts to google Contacts Automatically

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sapyantuk
    Senior Member
    • Oct 2020
    • 265

    How to push Contacts to google Contacts Automatically

    Hello Friends,
    I am using google Integration extension to integrate my google account. I have more than 10000 Contacts In espo crm I have to push all contacts to Google Contacts . Till now i am pushing all contacts to google Mannually by Push to Google Button. Nowi want to push all contacts automatically to google . Please Help
    yuri

    Thanks in Advance
  • lazovic
    Super Moderator
    • Jan 2022
    • 814

    #2
    Hi,

    To select absolutely all contacts at once, click in the upper left corner (right next to the Name field) on the small inverted triangle next to the empty checkbox and select "Select All Results". I'm attaching a screenshot.

    Comment

    • dimyy
      Active Community Member
      • Jun 2018
      • 569

      #3
      We make hook to push contacts after any save.

      PHP Code:
      public function afterSave(Entity $entity, array $options = array())
      {
      $this->pushContact('102',$entity->id); // '102' is the espoId of the user authorized in google
      }
      
      public function pushContact($userId, $contactId)
      {
      $user = $this->entityManager->getEntity('User', $userId);
      $this->applicationUser->setUser($user);
      
      $googleContacts = $this->serviceFactory->create('GoogleContacts');
      $pushResult = $googleContacts->push('Contact', [ 'ids' => [$contactId]]);
      
      } 
      

      Comment

    • sapyantuk
      Senior Member
      • Oct 2020
      • 265

      #4
      where should i place this code ?

      yuri Any Other Option . Can we achive this through Workflow

      Comment

      Working...