how to retrieve data over associations of an non-committet object in an async microflow
Hi, Imagine the following: We have an object (Request) which the user can create and submit. The request itself is pretty complex and consists of a lot of associated data. We lead the user through a multi step wizard to populate the fields accordingly. Currently the creation of a new request object can take up to 2-3s because of the template we need to copy it from – which is too long. And these are some smaller ones, there might be cases for even bigger requests. We now have the plan to separate the creation of the initial data needed and the ones required for the pages to follow in the wizard. Let’s say we have 100 attributes on this request, but only 10 of them are used on the first page. This would mean we would only create the 10 attributes required (which must be faster) and create the other 90 attributes async. Note: The request is not committed at this point. I tried to associated the Request with the System.User to be able to pass the the User into the microflow and then retrieve the Request and finish the initialization of the other attributes. I set a breakpoint within the microflow and checked; I do receive the user. But neither a retrieve via association, nor a retrieve via Java (in-memory) and forcing a fresh retrieve like suggested in this question worked. I assume this, because the request is not committed and only in-memory and the microflow is executed async in a system context. Is this correct? How get I access to the associated items? How can I offload the rest of the initialization process into an async process and then pass it back to the user again? Edit: 2020-02-12T1407 I’ve made some progress I think: I’ve created a Java action which executes a microflow as follows: HashMap<String, Object> parameters = new HashMap<String, Object>(); parameters.put("Request", __Request); Core.executeAsync(this.getContext(), MicroflowName, false, parameters); This allows me retrieve the objects over the association and finish the initialization. But it doesn’t get shown in the fronend, even after a post-back and refresh via CommunityCommons.refreshClassByObject . Does anyone know how I can access it in the main thread again? Edit: I created a followup question for this
This is probably not the answer you hoped for, but personally i can't imagine any request that really needs a setup process that takes up several seconds. I have the feeling the complexity of this does not fit the purpose of what you are trying to achieve.
And in the case this complexity is unavoidable and necessary, wouldnt the users be aware that what they are doing is very complex and understand that a few seconds waiting time is nothing more than reasonable?