---
title: "setUserId Method"
canonical: https://customerscanvas.com/docs/cc4/customerscanvas.iframeapi.objectmodel.product.setuserid.htm
archived: true
applies_to:
  - product: "Customer's Canvas On-Premises"
  - product: "Design Editor"
    versions: ["4.4.25", "4.x (may differ)"]
---

**You’re viewing outdated documentation.** [View the latest Customer’s Canvas On-Premises documentation](https://customerscanvas.com/docs/on-premises/).

# setUserId Method

**Applies to:** Customer's Canvas On-Premises; Design Editor 4.4.25, 4.x (may differ) · **Archived documentation**
 
### Callable
 
- setUserId(userId:  string ) :  Promise &lt; [Product](https://customerscanvas.com/docs/cc4/customerscanvas.iframeapi.objectmodel.product.htm.md) &gt;

- Sets the user unique identifier and move user files to the user folder. For details, see the [Working with User Data](https://customerscanvas.com/docs/cc4/working-with-user-data.htm.md) topic.
  
 - example
     - ```
    editor.getProduct()
        .then(function (product) {
            // Get the current user id.
            console.log("Current user: " + product.userId);
            // Change userId and move the user's data.
            product.setUserId("JohnWood")
                .then(function (product) {
                    // Check new user id.
                    console.log("New user: " + product.userId);
                });
        })
        .catch(function (error) {
            console.error("Switching the userId failed with exception: ", error);
        });
    ```

#### Parameters

    - ##### userId: string 
  
        The user identifier.

#### Returns Promise &lt; Product &gt;
 
    The product instance with the specified user identifier.
