Service implementation

Following code is the service implementation for displaying the income column.

Line 12 associates the column with the sightly template

import java.util.Map;
import org.osgi.service.component.annotations.Component;
import com.adobe.cq.inbox.ui.InboxItem;
import com.adobe.cq.inbox.ui.column.Column;
import com.adobe.cq.inbox.ui.column.provider.ColumnProvider;

@Component(service = ColumnProvider.class, immediate = true)
public class IncomeProvider implements ColumnProvider {
@Override
public Column getColumn() {

return new Column("income", "Income", String.class.getName(),"inbox/customization/column-templates.html", "incomeTemplate");
}

@Override
public Object getValue(InboxItem inboxItem) {
Object val = null;

Map workflowMetadata = inboxItem.getWorkflowMetadata();

if (workflowMetadata != null && workflowMetadata.containsKey("income"))
    val = workflowMetadata.get("income");

return val;
}
}

Test on your server

NOTE
This article assumes you have installed the sample workflow and sample form from previous article in this series.

Submitting the form will trigger the workflow and a task is assigned to “admin” user. You should see appropriate icon under the income column

Previous page2 - Add custom column
Next page1 - Introduction

Experience Manager