---
title: "User needs to Log in again"
canonical: "https://help.fieldbuddy.com/space/FBDOCS/4585553946/User%20needs%20to%20Log%20in%20again"
format: markdown
---
To activate a new or changed configuration it is needed to ask the user to log out and log in again. Here are several ways to achieve this.

1. Ask the user 🙂
2. Use Apex Snippet (see below)
3. Use an Action (not added)


# Hard reset via Apex Snippet

You can use an apex snippet to trigger a hard reset.

*BELANGRIJK !:*

> ⚠️ Before triggering the snippet:  
> ⚠️ 
> ⚠️ 
> ⚠️ - Make sure `addHours(???)` is populated
> ⚠️ 
> ⚠️ For classic:
> ⚠️ 
> ⚠️ 
> ⚠️ For Swift:


```
List<User> users = [SELECT id, Name, IsActive, Profile.Name
                    	FROM User
                    WHERE Id in (
                    SELECT UserId
                     from UserPackageLicense
                      WHERE PackageLicense.NamespacePrefix = 'FIELDBUDDY')
                    AND IsActive = true];
List<FIELDBUDDY__Action__c> actions = new List<FIELDBUDDY__Action__c>();
for (User user : users) {
    FIELDBUDDY__Action__c action = new FIELDBUDDY__Action__c();
    action.FIELDBUDDY__Status__c = 'Open';
    action.FIELDBUDDY__Type__c = 'Hard Reset';
    action.FIELDBUDDY__Data__c = message;
    action.FIELDBUDDY__Scheduled_at__c = DateTime.now().addHours(????);
    action.FIELDBUDDY__Target__c = target;
    action.FIELDBUDDY__User__c = user.Id;
    actions.add(action);
}
   system.debug(actions.size());
insert actions;
```

Supported action types are: Message (both), Hard Reset (both), Backup (Swift only)  


## How to trigger the snippet?

1. Open Development console
2. Go to Debug / Open Execute anonymous Window (=CTRL + E= or =CMD + E= on mac)
3. Make sure this new window is empty
4. Check “Open log” to true
5. Paste the *changed* snippet above
6. Select until the last line and execute