This video explains and implements integration between Salesforce and Google Drive. The Apex trigger and handler code are available in the comments section.
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
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.
@@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.
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.
@@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
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.
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.
hey abhishek i am getting error as "17:35:05:669 VARIABLE_ASSIGNMENT [56]|resp1|"System.HttpResponse[Status=Unauthorized, StatusCode=401]"|0x5d6156aa".
How do we use this in the project.how to set the refresh token?everyday they cant change right?
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
Do some research if it is possible.
Teach us more salesforce integration
Sure, will come up with more integration videos 👍
Please do video for Salesforce with Google docs.
I followed the same procedure as you said..but the response for fist callout post is getting authorization error...
Please cross verify all the steps.
what if , i want to upload file and folder into my shared drive instead of my drive
i am using same code and object but file upload only salesforce file not upload in google drive
Check the logs and try to debug it, provide me any specific step where its breaking then I would be able to help.
can we change the filename to exact name that we uploaded in salesforce?
I cannot surely say with this API integration, if I find anything, I will update you.
I handled file name and specific folder issue guys.
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
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.
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?
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.
I have done to upload to specific folder with file name
@@evrengzib99
Could you please let us know the steps what you have followed.
How to get endpoint url ?
Check this documentation please,
developers.google.com/drive/api/reference/rest/v2
Do you have any GitHub repository for this?
No
@@Salesforcemetaverse can you make a video on integrating twilio with Salesforce and go to meeting with salesforce
@@AnishaTiwari-wb1el Are you asking for which specific communication (call/sms/email) integration using Twilio?
@@Salesforcemetaverse yes sms integration using Twilio
Where i sthe code i cant find it ?
It is available in the very early comments.
Can we integrate Salesforce with Google Docs?
I believe we should be able to, please check the reference link below,
developers.google.com/docs/api/reference/rest
Is there any possibility to do video for this integration?
@@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.
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.
@@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
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);
}
}
it is free api?
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.
ContentVersionTrigger:
trigger ContentVersionTrigger on ContentVersion (after insert) {
for(ContentVersion cv: trigger.new){
ContentVersionTriggerHandler.callGoogleDrive(cv.Id);
}
}
As well cpq from scratch
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.
@@Salesforcemetaverse sure sir, I'll check & marketing cloud is also we can learn sir ?
@@sauravincrt yes, please check in playlists, there’s marketing cloud, experience cloud, education cloud, SKUID, Einstein, Omnistudio and more.
@@Salesforcemetaverse oh that many learning modules sir ? Can i learn them all & ask my doubts sir ?
@@sauravincrt yeah, it’s all free to learn and I’ll surely try my best to answer your doubts.
hey abhishek i am getting error as "17:35:05:669 VARIABLE_ASSIGNMENT [56]|resp1|"System.HttpResponse[Status=Unauthorized, StatusCode=401]"|0x5d6156aa".
Ah, I see, please provide more information and screenshot as well. Also check all the steps again whether you’ve missed something.