Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

WebService call order problem

Avatar

Level 1
Hi,

I have a List that is bound to the results from a web
service. When I want to add items to this list, I call another web
service which stores the new item, then I call the web service the
list is bound to to get the new results. Occassionally, the call to
get the results registers on the server before the call to add the
new item. Is there a way to synchronize this so that my calls occur
in the proper order? Here's a snippet of my code:



<code>

accountService.addAccount.send(addAccountWindow.newAccountName);

accountService.getAccounts.send();

</code>
2 Replies

Avatar

Level 2
Hi Adan,



Let addAccount() return a Boolean "true" if it is successful,
otherwise, "false". After received "ture" from addAccount(), call
getAccounts().



Jeffrey

Avatar

Level 1
Thanks Jeffrey, I hadn't thought of that. I found today while
browsing the docs that there is a result event that is raised by
web service operations. I think I can use this to 'chain' these
calls together.



Adam