Hi, as subject says, I want to save the value "lastModifiedBy" on Adaptive Form Fragment, since is not saved by default. Also I don't want to save the user ID, but the User Name. For this I created a workflow to save this information, but the problem is that the workflow saves the user as "workflow-service" instead of the actual user who modified the form. I tried using javascript on the page but the value doesn't save on the actual node, but temporally on the page, so it doesn't work either. The solution it doesn't have to be a javascript or a workflow, anything that works is fine, but I'm quite limited and I can use only the CRX to create/modify files and the AEM Platform itself. I cannot use servlets for example. I know this complicate the task, but it's what I can work for. I hope you can give me a proper solution. Thanks in advance!
Best regards,
Luis.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
How are you getting the user name? It should be something like this:
User user = workflowSession.getUser();
String userName = user.getPrincipal().getName();
Do you have access to use Sling Event Jobs?
Thank you for your response.
This give a different user, but still give me the workflow user instead of the actual user who modified the form.
I'm not familar with Sling Event Jobs, if you could explain what are you referring to and see if I can manage to work with that. As I said, I can only modify AEM platform itself, I don't have a repository with code.
Views
Replies
Total Likes
Sling Event Jobs require code to fully implement, so without a codebase, they’re challenging to set up directly.
If you can access the metadataMap within your workflow’s workflow data, try adding the user ID at the beginning of the workflow.
String actualUser = workflowSession.getUser().getID(); // Save this in metadata early in the workflow.
workflowData.getMetaDataMap().put("initiatingUser", actualUser);
This should store the user ID who initiated the workflow. Even though it’s a step back from a true “username,” this may allow you to retrieve this value consistently through the workflow.
Views
Replies
Total Likes
@Blodwid Did you find the suggestion helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!
Views
Replies
Total Likes