Friday, 24 March 2017

Integrate Adobe AEM with Salesforce

Integrate Adobe AEM with Salesforce


Adobe AEM provide its extendable capabilities to integrate  with other products. Below demonstration describe how to connect Adobe AEM with Salesforce which is the market’s leading cloud based CRM System. AEM provide OOTB components for the integration purpose. It helps the organization to target the customers through web channels as per their status in CRM.

Steps to Connect to Salesforce:
AEM uses OAuth mechanism to connect to Salesforce. So , first we need to create an connected app inside salesforce to get customer secret and access token.

Go to login.salesforce.com. Click on Setup on the top right corner. Search for Apps and create a custom app. Fill in required details as shown in below images. Callback Url here accept only https urls, so our AEM must be SSL configured. Check here how to configure SSL in AEM. Callback url is the url of cloud service that we will create in AEM.

Create new custom app
Fill in the required details.

Select an image for your app.

Choose the required tabs for your custom app.

Choose the user profile for which the custom app will be visible in the Force.com AppExchange menu. You can make a custom app as the default custom app of the profile. If a custom app is set as the default for a profile, then you cannot make it invisible for that profile.

Create a new connected app. 
Search for apps in setup. Goto apps, scroll down to Connected apps section and create a new connected app. 
  • Fill all the required fields. 
  • Enable OAuth settings
  • Enter the callback url. Callback url should be HTTPS.  Check here how to enable HTTPS in AEM.
  • Select the OAuth scopes. Connection may not be established if scopes are not selected appropriately. Connection was not successful when I have selected only "Full Access". So I selected all the OAuth scopes.
  • Click on Manage button and Enable IP relaxation.
  • Take a note of consumer key and consumer secret. We need to enter these values in Salesforce cloud configuration in AEM.


Thats all your salesforce app is create. Now lets establish connection from AEM to Salesforce.

Create a salesforce cloud configuration:
Login to your AEM instance and navigate to http://localhost:4502/miscadmin#/etc/cloudservices/salesforce. Click on new and create a new cloud configuration.

Double click on the newly created cloud service configuration to edit. Login url will be auto populated on the dialog. Enter customer key and customer secret and click on connect to salesforce. If connection is successful, then success alert will be displayed as shown below.

Troubleshooting:
  1. Callback url should be HTTPS.  Check here how to enable HTTPS in AEM.
  2. Callback URL should be fully qualified path of your configuration page with extension.
  3. If we get this error response{"error":"invalid_grant","error_description":"authentication failure"} then check the authorization_url value. This value is hardcoded in the dialog in connector. So when we try to connect to ****.salesforce.com it tries to establish connection to login.salesforce.com.
  4. Adobe saleforce connector uses TLS 1.0 to connect to salesforce. Salesforce disabling TLS 1.0. Check Adobe's TLS 1.0 support ending - FAQ. Salesforce is requiring an upgrade to TLS 1.1 or higher by July 22, 2017. After clicking connect to salesforce, check browser console logs to see if any errors.
  5. Salesforce connector may not be able to connect succesfully if AEM is behind a proxy. Enable proxy in Open Day Commons HTTP Client 3.1 and  Apache HTTP Components Proxy Configuration.If that doesn't work then you may need to extend the connector and  modify SalesforceClient.java.
  6. Make sure to give the appropriate OAuth scope for the connected app. In sales force we need to remove Full Access (Full) OAuth Scopes, if we use this then refresh token will not be effective. Check here for more info.
  7. Sometimes we may not be able to refresh the Salesforce access_token using the rest api. Check here to resolve it.
  8. Salesforce takes 5-10 min to enable the app after creation, so connect AEM with Salesfore after that.
By now you will be able to establish connection to Salesforce.

63 comments :

  1. I recommend to read this blog because there is a Full information of salesforce integration form...
    salesforce integration

    ReplyDelete
    Replies
    1. Thank you so much for sharing with us. Appreciate them.

      Delete
    2. Hi Kishore Sir, We are doing SF integration with our aem application for sso functionality using authorisation code flow approach. I have completely got stuck with the approach. On login am taking the user to salesforce login page, user enters login creds and submits the form, it redirects back to aem, how and where to configure this call back url in aem, what is the script we need to write to read code parameter and send it back to salesforce to get access token. Please help on this, I have been got stuck from 2 weeks and missed deadlines. Please share the documents and implementation details([email protected]) if you have any. Thanks in advance.

      Delete
  2. Excellent post!!! The future of cloud computing is on positive side. With most of the companies integrate Salesforce CRM to power their business; there is massive demand for Salesforce developers and administrators across the world.Salesforce Training in Chennai | Salesforce Training Institutes in Chennai

    ReplyDelete
    Replies
    1. Great Article
      Cloud Computing Projects


      Networking Projects

      Final Year Projects for CSE


      JavaScript Training in Chennai

      JavaScript Training in Chennai

      The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

      Delete
  3. The article was very clear and it's usefull information salesforce Online Training Hyderabad

    ReplyDelete
  4. hey kishore

    did you try to export the usergenrated content to salesforce.. in the publish

    it is giving me error in 6.1/6.2 publish but not in author
    com.adobe.granite.workflow.WorkflowException: Process execution resulted in an error
    at com.adobe.granite.workflow.core.job.HandlerBase.executeProcess(HandlerBase.java:194)
    at com.adobe.granite.workflow.core.job.JobHandler.process(JobHandler.java:232)
    at org.apache.sling.event.impl.jobs.JobConsumerManager$JobConsumerWrapper.process(JobConsumerManager.java:512)
    at org.apache.sling.event.impl.jobs.queues.JobRunner.run(JobRunner.java:205)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Caused by: com.adobe.granite.workflow.WorkflowException: Failed to execute process
    at com.day.cq.workflow.compatibility.CQWorkflowProcessRunner.execute(CQWorkflowProcessRunner.java:108)
    at com.adobe.granite.workflow.core.job.HandlerBase.executeProcess(HandlerBase.java:184)
    ... 6 more
    Caused by: com.day.cq.workflow.WorkflowException: Crypto Exception in Lead Creation Workflow: Cannot convert byte data
    at com.adobe.cq.mcm.salesforce.SalesforceExportProcess.execute(SalesforceExportProcess.java:277)
    at com.day.cq.workflow.compatibility.CQWorkflowProcessRunner.execute(CQWorkflowProcessRunner.java:93)
    ... 7 more

    ReplyDelete
  5. Nice Blog with useful concept. I feel happy to see your informative blog, Thanks for sharing such a nice blog. Software Testing Training Institute in Chennai | Selenium Training Institute in Chennai | ISTQB Training Institute in Chennai

    ReplyDelete
  6. Very interesting article.Helps to gain knowledge about lot of information. Thanks for posting information in this blog...
    Java Training Institute in Chennai | Java Training Center in Velachery | Advanced java Courses in Porur

    ReplyDelete
  7. I have read your blog. Good and more information useful for me, Thanks for sharing this information keep it up....
    Dot Net Project Center in Chennai | Dot Net Project Center in Velachery | Dot Net Projects in OMR

    ReplyDelete
  8. Pretty article! I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision...
    Java Project Center in Chennai | Java Project Center in Velachery | Java Projects in Velachery

    ReplyDelete
  9. Very interesting blog which helps me to get the in depth knowledge about the technology, Thanks for sharing such a nice blog...
    IOT Project Center in Chennai | IOT Project Center in Velachery | IOT Projects for BE in Pallikaranai | IOT Projects for ME in Taramani

    ReplyDelete
  10. Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge.
    VLSI Project Center in Chennai | VLSI Project Center in Velachery | VLSI Projects in Pallikaranai | VLSI Projects in Guindy | VLSI Projects in Taramani

    ReplyDelete
  11. Very interesting topic. Helps to gain knowledge about lot of information. Thanks for posting information in this blog.
    Cloud Computing Project Center in Chennai | Cloud Computing Project Center in Velachery | Cloud Computing Project Center in Medavakkam

    ReplyDelete
  12. Really Very happy to see this blog. thanks for sharing such a amazing blog...
    Final Year Project Center in Chennai | Final Year Projects in Velachery

    ReplyDelete
  13. This is really very impressive article with useful content,thanks for sharing your amazing post.
    MatLab Project Center in Chennai | MatLab Project Center in Velachery | MatLab projects in Perungudi

    ReplyDelete
  14. Awesome Blog with informative concept. Really I feel happy to see this useful blog, Thanks for sharing such a nice blog.
    Java Project Center in Chennai | Java Projects Center in Velachery | Java Projects in Perungudi

    ReplyDelete
  15. Very interesting, good job and thanks for sharing such blog. It is very interesting to read. Its pretty good and well noted.
    Cloud Computing Project Center in Chennai | Cloud Computing Projects in Velachery

    ReplyDelete
  16. Excellent Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge...
    Final Year Projects for BCA in Chennai | Final Year Projects for BCA in Velachery | Final Year Projects for MCA in Velachery | Final year Projects in Velachery

    ReplyDelete
  17. Very nice information to updating..Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging…
    Electrical Project Center in Chennai | Electrical projects in Velachery | Electrical Projects in St.thomas Mount

    ReplyDelete
  18. Very interesting, good job and thanks for sharing such blog. It is very interesting to read. Its pretty good and well noted. All your points are very useful.
    Cloud Computing Project Center in Chennai | Cloud Computing Projects in Velachery | Cloud Computing Projects in Chrompet

    ReplyDelete
  19. I read this article. I think You put a lot of effort to create this article. I appreciate your work.
    Embedded System Training Institute in Chennai | Embedded Training Center in Velachery | Embedded Training in Guindy

    ReplyDelete
  20. Thanks for sharing this information, it helped me a lot in finding valuable resources for my career
    Java Training Institute in Chennai | Java Training Center in Velachery | java Training in Chennai

    ReplyDelete
  21. It is very awesome and wonderful to visit your site.Thanks for sharing this information,this is helpful to me a lot...
    Java Training Institute in Chennai | java Training Center in Velachery | Java Training in Velachery | Online Training Institute in Velachery

    ReplyDelete
  22. I have read your blog. Your information is really useful for beginner. information provided here are unique and easy to understand.Thanks for this useful information.......
    PCB Design Training in Chennai | PCB Training Institute in Velachery | PCB Courses in Velachery | Online Training Institute in Velachery

    ReplyDelete
  23. Your Post is really wonderful and amazing content.Thanks for sharing such a useful blog and really good...
    Java Training Institute in Chennai | Java Training Center in Velachery | Online Training Institute in Velachery

    ReplyDelete
  24. Brilliant article. The information I have been searching precisely. It helped me a lot, thanks. Keep coming with more such informative article.
    C and C++ Training Institute in Chennai | C and C++ Training Center in Velachery | C & C++ Training in Velachery | Online Training in Velachery

    ReplyDelete
  25. I have read your blog, its really very attractive and impressive. I like it your post. Thanks for sharing such a wonderful blog with us...
    PCB Training Institute in Chennai | PCB Training Center in Velachery | PCB Online Courses in Velachery | Online Training Center in Velachery

    ReplyDelete
  26. I have read your blog. Your information is really useful for beginner. information provided here are unique and easy to understand. Thanks for this useful information. This is a great inspiring article. I am pretty much pleased with your good work.
    AWS Training Institute in Chennai | AWS Training Center in Velachery | AWS Certification Training in Velachery

    ReplyDelete
  27. Excellent post... Thank you for sharing such a informative and information blog with us.keep updating such a wonderful post..
    MicorSoft Azure Training Institute in Chennai | Azure Training Center in Chennai | Azure Certification Training in velachery | Online Azure training in Velachery

    ReplyDelete
  28. It is amazing and wonderful to visit your site. Thanks for sharing this information, this is helpful to me a lot...
    CCNA Training Institute in Chennai | CCNA Training Center in Velachery | CCNA Courses in Velachery | CCNA Online Training in Velachery

    ReplyDelete
  29. Your blog is really amazing, its very informative article and useful for everyone.. Thanks for
    sharing such a nice post..
    Java Training Institute in Chennai | Java Training Center in Velachery | Java Courses in Velachery | Java online Training in Velachery

    ReplyDelete
  30. if it is done incorrectly, one could end up in building incorrect apps without gaining the desired results and are incompatible with each other. This makes it more beneficial and safe to work with a Salesforce Lightening Developer so that one does not waste time and energy in building inappropriate apps. Salesforce training in Chennai

    ReplyDelete
  31. Really excellent blog.It is very useful for us. Thaks for for such amazing blog. Keep sharing such excellent blog.
    PMP Certification Center in Chennai | PMP Certification Online Training | PMP Certification Offline Training

    ReplyDelete
  32. Nice information .It is very useful for all.keeping sharing such excellent blogs.It is useful for us.
    JAVA Training Institute in

    Chennai
    | JAVA Online

    Training Institute in Chennai
    | JAVA Training Offline Institute in Chennai

    ReplyDelete
  33. Very informative blog.Thanks for sharing such a excellent blog.It is very useful for us.keep sharing

    such amazing blogs.
    SELENIUM Training

    institute in chennai
    | SELENIUM Online Training institute in chennai | SELENIUM Offline

    Training institute in chennai

    ReplyDelete
  34. Really very nice blog.It is very informative and useful for everyone.Thanks for sharing a wonderful blog.
    AWS Training Institute in Chennai | AWS Online Training Institute in Chennai | AWS Offline Training Institute in Chennai

    ReplyDelete
  35. Really amazing informative blog.Excellent blog with unique content.It is very useful for us.Thanks for

    sharing such a wonderful blog.
    C and C++ Training Institute in Chennai | C and C++ Online Training Institute in Chennai | C and C++ Offline Training Institute in Chennai

    ReplyDelete