• Sayantan Basu

SDL Tridion Content Mashup as Component Link!

Updated: Aug 27, 2019

You may already have seen the concept of doing content mashup using Tridion Sites Connector. If not you can check this blog from Manish to get an idea.

Today I am going to share another way to do that between Sites and Docs.

Assume you have maintained all of your products on sites and you want to add a product specification (Topic) from Docs along with that.

Using sites connector is one of the options for that. But there is another way to achieve it using a component link.

Here is the approach for that –

I have segregated the implementation in 2 parts.

First Part-

  1. I have created an MVC application (Not Mandatory, you can use ASP.Net application as well) to connect the Tridion Docs using service API and retrieve all the topics/publications from DOCS Content Manager and bind the result in a grid view.

  • Here is the code to get all the Topics/Publication using DOCS service API

         To retrieve the Topics:

  To retrieve the Publications:

2. Deploy the application on the web server and run it. Here are the look and feel of the application -

3. As you can see in the screenshot, there is an option to choose the item and click on the button ("Add To CMS") to add it to Tridion CMS. In a nutshell, the functionality is once the user clicks on that button the GUID of that selected topic/publication will be added as a link. For that, you need to add below necessary javascript on the view.

  • Here is the Javascript I am using to add that 

Now bind this URL with your schema field so that you can use it as Custom URL extension. ( If you are not familiar with custom URL extension, there is a nice blog on this from Neetesh Narvaria. You can follow this as a starting point.)

We have finished all the required step to mashup the content from the Tridion CMS side.

Second Part-

In this section, I will explain how to retrieve the actual content from DOCS based on that GUID using CPA on the web application end.

I am using SDL DXA on the web application side so I try to utilize the existing methods to retrieve the data.

  1. First I have added an InputItemFilter to pass that GUID as InputCustomMetaCriteria. Here is the code snippet for that -

2. Once InputItemFilter criteria are ready to use, call the Graphql client and call ExecuteItemQuery() method using the necessary parameter to get the result -

That’s all. Hope you like it. Happy coding. Here is the source code of Custom Application.

82 views0 comments