Object model for record, user

Is there a list of all available system attributes for the record, and also for the user?

I checked the reference, but I didn’t see CreatedBy or UpdatedBy as options for the record.

How does Corteza uniquely identify users? Is there an ID number, or does it use the handle attribute?

1 Like

Hi,

This is the response when you get a user:

{
    "response": {
        "userID": "359617995137351684",
        "username": "",
        "email": "qsbadzss@sharklasers.com",
        "name": "qsbadzss",
        "handle": "qsbadzss",
        "kind": "",
        "meta": {
            "avatarID": "359618043170521092",
            "avatarKind": "avatar-initials",
            "avatarColor": "#162425",
            "avatarBgColor": "#F3F3F3",
            "preferredLanguage": "en",
            "securityPolicy": {
                "mfa": {
                    "enforcedEmailOTP": false,
                    "enforcedTOTP": false
                }
            }
        },
        "emailConfirmed": true,
        "createdAt": "2023-10-17T21:23:49Z",
        "updatedAt": "2023-10-17T21:24:17Z",
        "canGrant": true,
        "canUpdateUser": true,
        "canDeleteUser": true
    }
}

You can see there is a handle (user.handle) and this value is indeed unique. user.email is also unique. So you can use those values to find a user in a workflow (iterating over users and seeing if the handle or email match to what you are looking for).

But, inside Corteza, the userID is used to reference a user (user.userID, similar to record.recordID). So when you look at the value of record.ownedBy you’ll see that ID.

Hope this makes it clearer.

OK, so that’s what you get if you pull it as a resource, either by ID number or through a search. that’s good.

Is there a way to pull the current (logged in) user attributes?

Yes, you can get the currently logged-in user with the “invoker” variable. This variable contains the ID of the user that triggers the workflow.

As you can see, I retrieve it as a string and after that I change it into a “ID” format for my workflow. For example, to do a user lookup.

2 Likes

Is there a way to determine if a user is suspended or not?

Also, what is the difference between user.name and user.username?

username was deprecated as far as i know.
name is “Full Name” in admin area/users

https://docs.cortezaproject.org/corteza-docs/2023.9/integrator-guide/expr/type-reference.html#objref-user

So, if the SuspendedAt field is populated, the user is suspended?

Does unsuspending the user clear the SuspendedAt field?

Best you try and see, afaik yes.