Expand my Community achievements bar.

SOLVED

AEMaaCS - http request to publisher from author - workflows

Avatar

Level 10

Hi,

There’s a workflow that executes on author but page is on publisher and the workflow hand off occurs via AEM forms from publisher to author for some PUT requests with error handling.

 

With an error at any step of the workflow on author , how do I send the notification to publisher from author, to display to the user ? 


want to ensure I cautiously pass data between instances I believe sling event can help but not sure I should over engineer it 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Level 3

Hi @NitroHazeDev,

 

My thoughts on this one: Workflows may not be the correct option when dealing with user submit actions and showing them appropriate error messages based on the REST flow, because for some reason if the workflow gets queued, then showing real time responses to the user might be delayed. Since you said you cannot invoke servlets via JS, have you thought of using custom submit action for the form? From what I see, it is possible to write a custom action with a JSP file by which you can call your servlet and handle the error as well.

https://experienceleague.adobe.com/en/docs/experience-manager-65/content/forms/customize-aem-forms/c...

 

Let me know if this helps!

 

Thanks!

View solution in original post

6 Replies

Avatar

Community Advisor

Hi, 

I think it is important to clarify that the type of "users" you deal with in the Author instance are "Content authors," and the type of "users" you deal with in a Publisher instance are "final users" or users who utilize your application (website). In most cases, these roles won't necessarily overlap, and you probably wouldn't want to notify a final user about something stuck in an authoring process.

However, to answer your question, the way you could communicate this is via content updates on the publish instance. You can then listen for the type of content being added/removed on the publish instance and act accordingly.

Please check these threads: https://cqdump.joerghoh.de/2022/02/03/the-deprecation-of-sling-resource-events/ 

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/resourcechangelistener-for... 

 

Hope this helps



Esteban Bustamante

Avatar

Level 10

Hi @EstebanBustamante  , long story short .. I am trying to get about an issue with forms submitting to multiple end points and more. Workflows is an option 

 

end users submit form on pub - workflow on author gets invoked and end point requests are made and data is updated.  At this point there could have been failures that I would handle as part of workflows but wondering if we could display the success or error  it to end user on publisher

unfortunately JS cannot be used to invoke FDM ATM.

i am not a fan of sending it over from author to pub since I am dealing with workflows but trying to hear everyone’s thoughts here 

Avatar

Level 10

@EstebanBustamante  Other than replicate , are there other stable and less invasive approaches perhaps OOTB or other means to send this over to display to the user without persist or other means (minus replication) ? 

Avatar

Community Advisor

No, that I am aware of. I think the ideal approach would be to use JS to invoke a servlet running on the author server, which wraps all those backend calls or any other operations. Then, you can display the error based on this servlet's response. However, if you are using a workflow, this is an asynchronous operation and I don't fully understand if you are displaying errors asynchronously in your application as well. If so, I think you could consider other approaches, all using JS, such as polling an endpoint to check for new errors. Alternatively, I would explore Server-Sent Events to achieve this: https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events

 

Hope this helps



Esteban Bustamante

Avatar

Correct answer by
Level 3

Hi @NitroHazeDev,

 

My thoughts on this one: Workflows may not be the correct option when dealing with user submit actions and showing them appropriate error messages based on the REST flow, because for some reason if the workflow gets queued, then showing real time responses to the user might be delayed. Since you said you cannot invoke servlets via JS, have you thought of using custom submit action for the form? From what I see, it is possible to write a custom action with a JSP file by which you can call your servlet and handle the error as well.

https://experienceleague.adobe.com/en/docs/experience-manager-65/content/forms/customize-aem-forms/c...

 

Let me know if this helps!

 

Thanks!

Avatar

Administrator

@NitroHazeDev 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!  



Kautuk Sahni