Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Form-centric workflow: How to implement a OSGi service for custom metadata (assign task)

Avatar

Avatar
Validate 1
Level 1
Richard_Wegier
Level 1

Likes

0 likes

Total Posts

12 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
Richard_Wegier
Level 1

Likes

0 likes

Total Posts

12 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
Richard_Wegier
Level 1

04-11-2020

Hello

Currently I'm working on forms-centric workflows. I'm using the assign task component and I need to add some custom values into the custom email templates. As per documentation (https://docs.adobe.com/content/help/en/experience-manager-65/forms/publish-process-aem-forms/use-met... I should be able to write my own OSGi service which prepares the metadata map.

Unfortunately I'm not able to successfully get the OSGi service listed in the field Assign Task --> Advanced --> Custom Metadata. It seems that the above linked documentation is incomplete (e.g. see point 4).

Was anyone able to create such a OSGi service and get it listed for selection? If so, is there a working example available?

Kind regards
Richard

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Ignite 1
Level 7
GirishBedekar
Level 7

Likes

167 likes

Total Posts

239 posts

Correct Reply

37 solutions
Top badges earned
Ignite 1
Give Back 5
Give Back 3
Give Back 10
Give Back
View profile

Avatar
Ignite 1
Level 7
GirishBedekar
Level 7

Likes

167 likes

Total Posts

239 posts

Correct Reply

37 solutions
Top badges earned
Ignite 1
Give Back 5
Give Back 3
Give Back 10
Give Back
View profile
GirishBedekar
Level 7

04-11-2020

Richard_Wegier
Thank you very much! Can you also provide the necessary maven dependency?
Richard_Wegier

Thank you very much!

 

Can you also provide the necessary maven dependency? When I implement the mentioned interface I have to override

public Map<String, String> getUserMetadata(WorkItem workItem, WorkflowSession workflowSession, MetaDataMap metadataMap) {
}

 

I'm working with AEM Forms 6.5 SP6.

GirishBedekar
<dependency> <groupId>com.adobe.aemfd</groupId> <artifactId>aemfd-client-sdk</artifactId> <version>6.0.122</version> </dependency>
Richard_Wegier
Thank you for the dependency! The versioning of the dependencies is a little confusing. Anyhow, I was now able to implement the interface but the implementation is still not shown in the selection. I'm currently investigating why (any hints are welcome 🙂 )
GirishBedekar
Yes the version are confusing
Richard_Wegier

I got it working but I had to adapt the code a bit:

 

import com.adobe.fd.workspace.service.external.WorkitemUserMetadataService;
import com.adobe.granite.workflow.WorkflowSession;
import com.adobe.granite.workflow.exec.WorkItem;
import com.adobe.granite.workflow.metadata.MetaDataMap;

import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Properties;
import org.apache.felix.scr.annotations.Property;
import org.apache.felix.scr.annotations.Service;
import org.osgi.framework.Constants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.HashMap;
import java.util.Map;

@Component
@Service
@Properties({
        @property(name = Constants.SERVICE_DESCRIPTION, value = "A sample implementation of a user metadata service."),
        @property(name = WorkitemUserMetadataService.SERVICE_PROPERTY_LABEL, value = "Default User Metadata Service")})
public class WorkItemUserServiceImpl implements WorkitemUserMetadataService {
    private static final Logger log = LoggerFactory.getLogger(WorkItemUserServiceImpl.class);

    @Override
    public Map<String, String> getUserMetadata(WorkItem workItem, WorkflowSession workflowSession, MetaDataMap metadataMap) {
        HashMap<String, String> customMetadataMap = new HashMap<String, String>();
        return customMetadataMap;
    }
}

Answers (3)

Answers (3)

Avatar

Avatar
Ignite 1
Level 7
GirishBedekar
Level 7

Likes

167 likes

Total Posts

239 posts

Correct Reply

37 solutions
Top badges earned
Ignite 1
Give Back 5
Give Back 3
Give Back 10
Give Back
View profile

Avatar
Ignite 1
Level 7
GirishBedekar
Level 7

Likes

167 likes

Total Posts

239 posts

Correct Reply

37 solutions
Top badges earned
Ignite 1
Give Back 5
Give Back 3
Give Back 10
Give Back
View profile
GirishBedekar
Level 7

04-11-2020

I will send you a sample code soon

i have it somewhere on my laptop

Avatar

Avatar
Ignite 1
Level 7
GirishBedekar
Level 7

Likes

167 likes

Total Posts

239 posts

Correct Reply

37 solutions
Top badges earned
Ignite 1
Give Back 5
Give Back 3
Give Back 10
Give Back
View profile

Avatar
Ignite 1
Level 7
GirishBedekar
Level 7

Likes

167 likes

Total Posts

239 posts

Correct Reply

37 solutions
Top badges earned
Ignite 1
Give Back 5
Give Back 3
Give Back 10
Give Back
View profile
GirishBedekar
Level 7

04-11-2020

Yes the versions are confusing. We are going to start naming the versions which are in sync with AEM forms release version

sorry for the confusion 

Avatar

Avatar
Ignite 1
Level 7
GirishBedekar
Level 7

Likes

167 likes

Total Posts

239 posts

Correct Reply

37 solutions
Top badges earned
Ignite 1
Give Back 5
Give Back 3
Give Back 10
Give Back
View profile

Avatar
Ignite 1
Level 7
GirishBedekar
Level 7

Likes

167 likes

Total Posts

239 posts

Correct Reply

37 solutions
Top badges earned
Ignite 1
Give Back 5
Give Back 3
Give Back 10
Give Back
View profile
GirishBedekar
Level 7

04-11-2020

Let me know If you have questions on the link I sent you

we will update the other link as well

thanks