Announcement

Collapse
No announcement yet.

Get particular user's all information

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Get particular user's all information

    Hello,

    I am using the below code to check the current user created the current entity or not.

    this.getUser().id==this.model.get('createdById')

    How to check the current user Country (Custom Field) = Current entity created by user Country (Custom Field).

    this.getUser().country==this.model.get('createdByI d').country Does this works?

    Thanks.

  • #2
    Hello,
    this.getUser().get('country') - country of current user,
    but this.model.get('createdById') returns only id (string). You need user object. after you load it, you can get country value with userModel.get('country).

    Comment


    • #3
      Thanks Tanya,

      Can you give me the exact syntax? Or please let me know this is correct,

      For getting the current user ID,

      var someUsr = this.model.get('createdById');
      var someUsrCountry = someUsr.userModel.get('country)

      Will the above method work?

      Thanks.

      Comment


      • #4
        Tanya,

        How to load the user object, can you please explain.?

        Thanks.

        Comment


        • #5
          call API 'api/v1/User/' + this.model.get('createdById')

          Comment


          • #6
            Yes as you said i parsed the api, and it worked.

            Thank you.

            $.getJSON('User/' + this.model.get('createdById'), function (json) {
            console.log(json);
            });
            Last edited by VigneshChinnaiyan; 07-12-2018, 11:36 PM.

            Comment


            • #7
              parse the data, you get. What the problem? You can load retrieved data in the model and use as object or not, as you wish.

              Comment


              • #8
                Tanya,

                Thank you so much, It worked.
                Last edited by VigneshChinnaiyan; 07-12-2018, 11:35 PM.

                Comment

                Working...
                X