# application.closeSolution

**URL:** https://forum.servoy.com/t/application-closesolution/13811
**Category:** Classic Servoy
**Created:** [April 4, 2011, 6:12pm UTC](https://forum.servoy.com/t/application-closesolution/13811 "2011-04-04T18:12:57Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Tokajac](https://avatars.discourse-cdn.com/v4/letter/t/838e76/32.png) [@Tokajac](https://forum.servoy.com/u/Tokajac)
#### Post date: [April 4, 2011, 6:12pm UTC](https://forum.servoy.com/t/application-closesolution/13811/1 "2011-04-04T18:12:57Z")

</div>

Hello,

How to use  
application.closeSolution([solutionToLoad],[method],[argument])  
on clean way?

Currently with  
application.closeSolution(“TestSolution”)  
it mixes up foundset that contains tenants, for example.  
Do I need to terminate session or sg further? How to improve?

So I need new session like if I’d close and then re-start again the Smart/Web client from Developer

Regards

---

<div class="post-metadata">

### Author: ![pbakker](https://avatars.discourse-cdn.com/v4/letter/p/a4c791/32.png) [@pbakker](https://forum.servoy.com/u/pbakker)
#### Post date: [April 5, 2011, 9:16am UTC](https://forum.servoy.com/t/application-closesolution/13811/2 "2011-04-05T09:16:57Z")

</div>

What exactly is mixed up?

Paul

---

<div class="post-metadata">

### Author: ![Tokajac](https://avatars.discourse-cdn.com/v4/letter/t/838e76/32.png) [@Tokajac](https://forum.servoy.com/u/Tokajac)
#### Post date: [April 5, 2011, 9:59am UTC](https://forum.servoy.com/t/application-closesolution/13811/3 "2011-04-05T09:59:41Z")

</div>

In properties of my solution firstForm is frm\_main\_menu, loginForm is frm\_login.

workflow:  
-login to solution via the frm\_login;  
-clicked on button that invokes action which last line of code is

```auto
application.closeSolution("TestSolution")

```

-frm\_login doesn’t appear but goes directly to the frm\_main\_menu. This causes that tenants are not loaded properly on restart, in my case .

How to restart the solution completely? So to go back to frm\_login again? That will solve the problem, I think.  
Do I need to unload all forms explicitly? How?

I’ve also tried to

```auto
application.closeSolution("TestSolution", "firstMethodName")

```

but doesn’t work as Servoy’s order not seem to be correct anymore

How to reach clean re-start (point on elegant way)?

Regards

---

<div class="post-metadata">

### Author: ![pbakker](https://avatars.discourse-cdn.com/v4/letter/p/a4c791/32.png) [@pbakker](https://forum.servoy.com/u/pbakker)
#### Post date: [April 5, 2011, 10:23am UTC](https://forum.servoy.com/t/application-closesolution/13811/4 "2011-04-05T10:23:57Z")

</div>

When doing this through application.closeSolution(), the user remains logged in if he is logged in.

I think what you’re looking for is security.logout(‘solution\_name’,‘global\_method\_name’,‘my\_argument’);

Paul

---

<div class="post-metadata">

### Author: ![Harjo](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/harjo/32/4873_2.png) [@Harjo](https://forum.servoy.com/u/Harjo)
#### Post date: [April 5, 2011, 11:52am UTC](https://forum.servoy.com/t/application-closesolution/13811/5 "2011-04-05T11:52:04Z")

</div>

this is the one, we use:

```auto
	security.logout()
	application.closeSolution('TestSolution')

```

---

<div class="post-metadata">

### Author: ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)
#### Post date: [April 5, 2011, 1:25pm UTC](https://forum.servoy.com/t/application-closesolution/13811/6 "2011-04-05T13:25:38Z")

</div>

if you use logout then the solution will be closed if the user was logged in (and the solution requires authentication)

so in harjo’s example this should be only needed:

security.logout(‘TestSolution’)

---

<div class="post-metadata">

### Author: ![bobcusick](https://avatars.discourse-cdn.com/v4/letter/b/ba9def/32.png) [@bobcusick](https://forum.servoy.com/u/bobcusick)
#### Post date: [April 6, 2011, 5:52pm UTC](https://forum.servoy.com/t/application-closesolution/13811/7 "2011-04-06T17:52:03Z")

</div>

Great tip! Thanks, Johan! Might be a good idea to add this to the documentation Wiki…

---

<div class="post-metadata">

### Author: ![jcompagner](https://yyz2.discourse-cdn.com/flex010/user_avatar/forum.servoy.com/jcompagner/32/4889_2.png) [@jcompagner](https://forum.servoy.com/u/jcompagner)
#### Post date: [April 7, 2011, 7:54am UTC](https://forum.servoy.com/t/application-closesolution/13811/8 "2011-04-07T07:54:18Z")

</div>

i think it pretty logical especially when the solution requires authentication…  
Because what else can we do? If the solution requires authentication then closeSolution is the only solution when you logout.

The only thing is if the solution doesn’t require authentication what should we do then? Just also always close it? To be consistent?  
I also don’t think that this will not happen a lot. If you use security/login then i guess the solution is configured to use it.
