How Can I Automatically Close A Form?

How Can I Automatically Close A Form?

Comments

  • I have a flow which calls an external web service and it can take awhile to complete. I would like to be able to call the web service and display a user form notifying the user that it is running while also giving them the option to wait on the process or be notified when completed. In what way can I implement the form closing automatically when the web service completes?

  • [font=Roboto, sans-serif]1) Put your web service call in an async flow. In this flow, make the web service call, and once it completes set a flag in the cache. You can use whatever values you want for the cache instance name and key, but cache type name needs to be Default.MemoryCache [/font]
    [font=Roboto, sans-serif]
    [/font]
    [font=Roboto, sans-serif]2) On your form have two outcomes. One for Be Notified and one for Wait. The Wait button should have Initially Visible set to false.[/font]
    [font=Roboto, sans-serif]
    [/font]
    [font=Roboto, sans-serif]3) Add a check box on the form that has Initially Visible set to false.[/font]
    [font=Roboto, sans-serif]
    [/font]
    [font=Roboto, sans-serif]4) Create a data flow that gets your flag from the cache and checks if it is finished or not. The data flow should update the checkbox on the form to true if the web service is finished[/font]
    [font=Roboto, sans-serif]
    [/font]
    [font=Roboto, sans-serif]5) The data flow does not need a trigger. Instead set it to Auto Run. The time you set here is how often the flow will run to check if the web service is finished.[/font]
    [font=Roboto, sans-serif]
    [/font]
    [font=Roboto, sans-serif]6) Set up an Outcome Rule on the form that is triggered by the value in the check box changing. When it evaluates true it will automatically close the form using the Wait outcome. The form will now run as soon as the web service starts and will stay open until the web service is finished or someone clicks the Be Notified button.[/font]
    [i]edited by jerramy@decisions.com on 4/4/2019[/i]

Sign In or Register to comment.