Try our conversational search powered by Generative AI!

Episerver Forms: How to pass data from Custom PostSubmissionActor to java script

Vote:
 

Hello,

Is there any possibility to pass data from custom PostSubmissionActor Run(object input) method to be available in java script?

$$epiforms(".EPiServerForms").on("formsNavigationNextStep formsNavigationPrevStep formsSetupCompleted formsReset formsStartSubmitting formsSubmitted formsSubmittedError formsNavigateToStep formsStepValidating", function (event, param1, param2) {
            console.log($(this).get(0), event);
        });

I already created custom PostSubmissionActor, set IsSyncedWithSubmissionProcess to true, created custom object that is returned from Run method and I am wondering if there is possibility to somehow get object that is returned from method in view in java script event handler.

object Run(object input)
{
return new { customData = "customData"};
}

FYI: During my investigations I saw that DataSubmissionService is responsible for running ActorsExecutingService that is responsible for running particular PostSubmittionActors but I do not found place where the result of Run method is propagated to SubmitActionResult that is returned from DataSubmitController.

Could you help me with this problem?

Thanks in advance,

Tomasz

#176570
Mar 22, 2017 8:10
Vote:
 

From my understand, you need to create your own DataSubmissionService (and replace the default one using ServiceLocator) which inherit from original one, then you override the method PerformDataSubmit add your extra data to the SubmitActionResult object returned. That return object will be send to client which you can catch from javascript.

Since the result of the actor's Run method is not sent in SubmitActionResult, you only can modify the PostSubmissionActorBase.SubmissionData to add your extra information then catch it in your DataSubmissionService.

#176571
Mar 22, 2017 10:08
Vote:
 

Thanks for reply!

Yes, I know that injecting my own services is possible to achieve the goal. But is there any build in mechanism into Forms that allow me to propagate result from Run method to the response from controller (out of the box)? 

Thanks,

Tomasz

#176573
Mar 22, 2017 10:28
Vote:
 

Currently, there is no mechanism like that, but it might be consider as a feature request and implement in future.

Thanks

#176574
Mar 22, 2017 10:33
Vote:
 

Ok. I needed that confirmation.

Topic could be closed.

Thanks,

Tomasz

#176575
Mar 22, 2017 10:44
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.