# Cannot get additional fields in a rule after Sign Up

**URL:** <https://community.auth0.com/t/cannot-get-additional-fields-in-a-rule-after-sign-up/57171>\
**Category:** Get Help\
**Tags:** signup, rules, lock, auth0\
**Created:** [February 1, 2021, 10:10pm UTC](https://community.auth0.com/t/cannot-get-additional-fields-in-a-rule-after-sign-up/57171 "2021-02-01T22:10:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ricardo.jimenez](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ricardo.jimenez/32/25955_2.png) [@ricardo.jimenez](https://community.auth0.com/u/ricardo.jimenez)\
**Post date:** [February 1, 2021, 10:10pm UTC](https://community.auth0.com/t/cannot-get-additional-fields-in-a-rule-after-sign-up/57171/1 "2021-02-01T22:10:02Z")

</div>

Hey Folks!

I’m having an issue where I need to have the name at sign up, I already did the additional field in lock (snippet down), then I need to update the root attribute for name, using that additional field. The problem I’m facing is that I’m not able to get that additional field in the rule, whithin `user_metadata` nor `app_metadata` after **sign up**.

Any help is welcome.

Additional Filed Snippet:  
additionalSignUpFields: [{  
name: “full\_name”,  
placeholder: “Enter your full name”,  
validator: function (name) {  
return {  
valid: name.length !== 0,  
hint: “Please fill your name”  
}  
}  
}]

Rule snippet:

```
function addUserNameRootAttrs(user, context, callback) {
  user.user_metadata = user.user_metadata || {};
  console.log('Users\'s object: ', user);
  console.log('Users\'s context object: ', context);
  if (user.user_metadata.profile.name !== user.name) {
    var ManagementClient = require('auth0@2.23.0”').ManagementClient;
    var management = new ManagementClient({
      clientId: configuration.AUTH0_CLIENT_ID,
      clientSecret: configuration.AUTH0_SECRET,
      domain: configuration.AUTH0_DOMAIN,
      scopes: ['update:profile'],
    });

    var params = { id: user.user_id };
    var data = { name: user.user_metadata.profile.name };
    management.users.update(params, data, function (err, user) {
      if (err) {
        throw err;
      }
      console.log('New Profile: ', user);
      callback(null, user, context);
    });
  }

  callback(null, user, context);
}

```

Thanks!

---

<div class="post-metadata">

**Author:** ![stephanie.chamblee](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/stephanie.chamblee/32/26087_2.png) [@stephanie.chamblee](https://community.auth0.com/u/stephanie.chamblee)\
**Post date:** [February 2, 2021, 3:04pm UTC](https://community.auth0.com/t/cannot-get-additional-fields-in-a-rule-after-sign-up/57171/3 "2021-02-02T15:04:24Z")

</div>

Hi @ricardo.jimenez,

Welcome to the Community!

The name is being stored as `user.user_metadata.full_name` instead of `user.user_metadata.profile.name`.

You can adjust your rule like this:

```auto
function addUserNameRootAttrs(user, context, callback) {
  user.user_metadata = user.user_metadata || {};
  console.log('Users\'s object: ', user);
  console.log('Users\'s context object: ', context);
  if (user.user_metadata.full_name !== user.name) {
    var ManagementClient = require('auth0@2.23.0').ManagementClient;
    var management = new ManagementClient({
      domain: auth0.domain,
      token: auth0.accessToken
    });

    var params = { id: user.user_id };
    var data = { name: user.user_metadata.full_name };
    management.users.update(params, data, function (err, user) {
      if (err) {
        throw err;
      }
      console.log('New Profile: ', user);
      callback(null, user, context);
    });
  }
  callback(null, user, context);
}

```

Alternatively, you can use the field name `"name"` and pass the `storage: "root"` parameter to lock and you will no longer need a rule to accomplish this.

```auto
      additionalSignUpFields: [{
        name: "name",
        placeholder: "Enter your full name",
        storage: "root",
        validator: function (name) {
          return {
            valid: name.length !== 0,
            hint: "Please fill your name"
          }
        }
      }]

```

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [February 17, 2021, 3:04pm UTC](https://community.auth0.com/t/cannot-get-additional-fields-in-a-rule-after-sign-up/57171/4 "2021-02-17T15:04:50Z")

</div>

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
