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.

91 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(nageshreddy51@gmail.com) 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
  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. 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
  7. 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
  8. 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
  9. 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
  10. 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
  11. 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
  12. 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
  13. 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
  14. 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
  15. 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
  16. 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
  17. 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
  18. 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
  19. 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
  20. 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
  21. 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
  22. Therefore, you will have the best market research strategies and will be able to satisfy your customers. Salesforce training in Chennai

    ReplyDelete
  23. The information you have here is really useful . It is truly supportive for us and I have accumulated some essential data from this blog.
    Web Designing Training Center in Chennai |
    Tally Training in Chennai |
    Selenium Training in Chennai |
    Summer Courses Training in Chennai|
    JAVA Training in Chennai |

    ReplyDelete
  24. Your Blog is really an amazing content to read, its very useful for everyone. thanks for sharing such an wonderful post..
    PMP Exam Center in Chennai | PMP Certification in Velachery | PMP Exams in Velachery | Online Certification in Chennai

    ReplyDelete
  25. Good information and really its very much useful Blog . Thanks for sharing and keep updating like this …….
    GRE Exams in Chennai|
    GRE Exams in Velachery|
    GRE Exams in Tharamani|
    GRE Exams in Perungudi|
    GRE Exams in Thambaram

    ReplyDelete
  26. Good information and really its very much useful Blog . Thanks for sharing and keep updating like this …….
    IELTS Exams in Chennai|
    IELTS Exams in Velachery|
    IELTS Exams in Tharamani|
    IELTS Exams in Perungudi|
    IELTS Exams in Thambaram

    ReplyDelete
  27. Nice post.. Its really an amazing with informative information and useful for everyone. Thanks for sharing your wonderful article..

    AWS Certification in Chennai | AWS Exam Center in Chennai | AWS Exams in Velacheri | AWS Online Exams in Velachery | Online Certification in Chennai

    ReplyDelete
  28. Really it was an awesome article...very interesting to read. You have provided an nice article....Thanks for sharing..
    MBA Project Center in Chennai | MBA Projects in Velachery

    ReplyDelete
  29. Really nice blog.. Thanks for posting this interesting article with us
    AWS Certification in Chennai | AWS Exam Center in Velachery

    ReplyDelete
  30. Thank you so much for such valuable information sharing. It’s highly appreciated
    Agile Scrum Master Training in Chennai | Agile Scrum Master Training in Velachery

    ReplyDelete