Salesforce Integration With Google Drive

Поделиться
HTML-код
  • Опубликовано: 31 окт 2024
  • This video explains and implements integration between Salesforce and Google Drive.
    The Apex trigger and handler code are available in the comments section.

Комментарии • 54

  • @SathyaKrishnan-s9p
    @SathyaKrishnan-s9p 2 дня назад

    How do we use this in the project.how to set the refresh token?everyday they cant change right?

  • @brijeshkumarkj9196
    @brijeshkumarkj9196 2 месяца назад

    had to make some changes to the code but it works well !! Thanks , but the file name is coming up Untitled , I wish that came up properly as well

  • @sauravincrt
    @sauravincrt Год назад +1

    Teach us more salesforce integration

    • @Salesforcemetaverse
      @Salesforcemetaverse  Год назад

      Sure, will come up with more integration videos 👍

    • @TBabu-r7m
      @TBabu-r7m 8 месяцев назад

      Please do video for Salesforce with Google docs.

  • @YojithsaiVemuri
    @YojithsaiVemuri 4 месяца назад

    I followed the same procedure as you said..but the response for fist callout post is getting authorization error...

  • @ikkibwjoo170
    @ikkibwjoo170 6 месяцев назад

    what if , i want to upload file and folder into my shared drive instead of my drive

  • @abhinavmaharshi5166
    @abhinavmaharshi5166 Год назад

    i am using same code and object but file upload only salesforce file not upload in google drive

    • @Salesforcemetaverse
      @Salesforcemetaverse  Год назад

      Check the logs and try to debug it, provide me any specific step where its breaking then I would be able to help.

  • @aakashjain8356
    @aakashjain8356 Год назад

    can we change the filename to exact name that we uploaded in salesforce?

    • @Salesforcemetaverse
      @Salesforcemetaverse  Год назад

      I cannot surely say with this API integration, if I find anything, I will update you.

    • @evrengzib99
      @evrengzib99 7 месяцев назад

      I handled file name and specific folder issue guys.

  • @aakashjain8356
    @aakashjain8356 Год назад

    hey i am using same code to integrate through custom objects and i am using rich text filed to store images and sending on google drive but the images which are getting upload on drive are corrupted so please can you help me out here

    • @Salesforcemetaverse
      @Salesforcemetaverse  Год назад

      Hi, I have not sent images yet using this integration, I need to see how you're doing and try to find resolution of your problem, maybe let's sit together on the weekend for 30 minutes and see.

  • @sagarchawale3233
    @sagarchawale3233 Год назад

    Hi, if we have folder with name New folder in Google Drive, can we save those shared Salesforce files automatically in that folder in google drive?

    • @Salesforcemetaverse
      @Salesforcemetaverse  Год назад

      I haven’t tried that you would have to check it if we can do that, using the Zapier we can do but this way via api I can’t say for sure.

    • @evrengzib99
      @evrengzib99 7 месяцев назад

      I have done to upload to specific folder with file name

    • @GowthamTadavarthi
      @GowthamTadavarthi 5 дней назад

      @@evrengzib99
      Could you please let us know the steps what you have followed.

  • @thalurumahendrababu
    @thalurumahendrababu 9 месяцев назад

    How to get endpoint url ?

    • @Salesforcemetaverse
      @Salesforcemetaverse  9 месяцев назад

      Check this documentation please,
      developers.google.com/drive/api/reference/rest/v2

  • @AnishaTiwari-wb1el
    @AnishaTiwari-wb1el 4 месяца назад

    Do you have any GitHub repository for this?

    • @Salesforcemetaverse
      @Salesforcemetaverse  4 месяца назад

      No

    • @AnishaTiwari-wb1el
      @AnishaTiwari-wb1el 4 месяца назад

      @@Salesforcemetaverse can you make a video on integrating twilio with Salesforce and go to meeting with salesforce

    • @Salesforcemetaverse
      @Salesforcemetaverse  4 месяца назад

      @@AnishaTiwari-wb1el Are you asking for which specific communication (call/sms/email) integration using Twilio?

    • @AnishaTiwari-wb1el
      @AnishaTiwari-wb1el 4 месяца назад

      @@Salesforcemetaverse yes sms integration using Twilio

  • @SiddheshAshtankar
    @SiddheshAshtankar 2 месяца назад

    Where i sthe code i cant find it ?

  • @TBabu-r7m
    @TBabu-r7m 8 месяцев назад

    Can we integrate Salesforce with Google Docs?

    • @Salesforcemetaverse
      @Salesforcemetaverse  8 месяцев назад

      I believe we should be able to, please check the reference link below,
      developers.google.com/docs/api/reference/rest

    • @TBabu-r7m
      @TBabu-r7m 8 месяцев назад

      Is there any possibility to do video for this integration?

    • @Salesforcemetaverse
      @Salesforcemetaverse  8 месяцев назад

      @@TBabu-r7m I will add it in my list but it’s mostly no because I do not like coding and it eats so much of my time, check tools like zapier, which saves a lot of time doing these integrations.

    • @TBabu-r7m
      @TBabu-r7m 8 месяцев назад

      Is this same as like Salesforce with Google Drive Integration? Then What is the String url I need to take please confirm once? Thank you for your help in advance. If you will do video for this integration, that is very helpful to us.

    • @Salesforcemetaverse
      @Salesforcemetaverse  8 месяцев назад

      @@TBabu-r7m That depends upon your specific requirement but I believe the endpoints would be the ones given in the documentation, you would to check it whether if you follow the same steps, it works or not

  • @Salesforcemetaverse
    @Salesforcemetaverse  Год назад +1

    ContentVersionTriggerHandler:
    public class ContentVersionTriggerHandler {
    @future(callout=true)
    public static void callGoogleDrive(String cvId){
    String key = '45945997044-ibcdlgjdah5ug01t60fjrgknd2ssenqc.apps.googleusercontent.com';
    String secert = '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';
    String redirect_uri = 'developers.google.com/oauthplayground';


    String accesstoken;
    String refreshToken = '1//04QkvioazkXTCCgYIARAAGAQSNwF-L9IrGPSUdFz-sNzm7Rx_x3OOovZqOyPnwYk_0qXKRGXnHAl0Ce1K3hO_n6YMp8Pk6L0lpFA';
    HttpRequest req2 = new HttpRequest();
    req2.setMethod('POST');
    req2.setEndpoint('www.googleapis.com/oauth2/v4/token');
    req2.setHeader('content-type', 'application/x-www-form-urlencoded');
    String messageBody = 'client_id=' + key + '&client_secret=' + secert + '&refresh_token='+refreshtoken+'&redirect_uri=' + redirect_uri + '&grant_type=refresh_token';
    req2.setHeader('Content-length', String.valueOf(messageBody.length()));
    req2.setBody(messageBody);
    req2.setTimeout(60 * 1000);
    Http h2 = new Http();
    String resp2;
    HttpResponse res2 = h2.send(req2);
    resp2 = res2.getBody();
    System.debug('resp2-->>'+resp2);
    JSONParser parser = JSON.createParser(resp2);
    while (parser.nextToken() != null) {
    if ((parser.getCurrentToken() == JSONToken.FIELD_NAME)) {
    String fieldName = parser.getText();
    parser.nextToken();
    if (fieldName == 'access_token') {
    accesstoken = parser.getText();
    } else if (fieldName == 'expires_in') {
    Integer expiresIn = parser.getIntegerValue();
    } else if (fieldname == 'token_type') {
    String tokentype = parser.getText();
    }
    }
    }

    ContentVersion cv=[select id,title,ContentDocumentId,versiondata from Contentversion where Id =: cvId ];

    Blob myBlob = cv.versiondata;
    String url = 'www.googleapis.com/upload/drive/v2/files?uploadType=media';
    string authorizationHeader = 'Bearer ' + accesstoken;
    Integer contentSize = myBlob.size();
    HttpRequest req1 = new HttpRequest();
    req1.setheader('Authorization',authorizationHeader);
    req1.setheader('Content-Length',String.valueOf(contentSize));
    req1.setheader('Content-Type','image/'+'PNG');
    req1.setheader('Content-Type','application/'+'pdf');
    req1.setMethod('POST');
    req1.setEndpoint(url);
    req1.setBodyAsBlob(myBlob);
    Http h1 = new Http();

    Httpresponse resp1 = h1.send(req1);
    }
    }

  • @dhananjaysarpe8261
    @dhananjaysarpe8261 7 месяцев назад

    it is free api?

    • @Salesforcemetaverse
      @Salesforcemetaverse  7 месяцев назад

      I believe API is free but you would need to pay for drive storage like we do for our personal Gmail storage.
      Check this link as well,
      developers.google.com/drive/api/guides/limits#:~:text=All%20use%20of%20the%20Google,your%20account%20is%20not%20billed.

  • @Salesforcemetaverse
    @Salesforcemetaverse  Год назад

    ContentVersionTrigger:
    trigger ContentVersionTrigger on ContentVersion (after insert) {
    for(ContentVersion cv: trigger.new){
    ContentVersionTriggerHandler.callGoogleDrive(cv.Id);
    }
    }

  • @sauravincrt
    @sauravincrt Год назад

    As well cpq from scratch

    • @Salesforcemetaverse
      @Salesforcemetaverse  Год назад

      Please check my CPQ series:
      ruclips.net/p/PLZmg_ySttr7D3WcNWARUDg_HjqX6qDODh
      Hope it covers quite well but still if something is missing, let me know I’ll try to prepare content around that as well.

    • @sauravincrt
      @sauravincrt Год назад

      @@Salesforcemetaverse sure sir, I'll check & marketing cloud is also we can learn sir ?

    • @Salesforcemetaverse
      @Salesforcemetaverse  Год назад

      @@sauravincrt yes, please check in playlists, there’s marketing cloud, experience cloud, education cloud, SKUID, Einstein, Omnistudio and more.

    • @sauravincrt
      @sauravincrt Год назад

      @@Salesforcemetaverse oh that many learning modules sir ? Can i learn them all & ask my doubts sir ?

    • @Salesforcemetaverse
      @Salesforcemetaverse  Год назад

      @@sauravincrt yeah, it’s all free to learn and I’ll surely try my best to answer your doubts.

  • @manojbankar-i2w
    @manojbankar-i2w Год назад

    hey abhishek i am getting error as "17:35:05:669 VARIABLE_ASSIGNMENT [56]|resp1|"System.HttpResponse[Status=Unauthorized, StatusCode=401]"|0x5d6156aa".

    • @Salesforcemetaverse
      @Salesforcemetaverse  Год назад

      Ah, I see, please provide more information and screenshot as well. Also check all the steps again whether you’ve missed something.