# Get role from System/User/RoleString

**URL:** <https://forum.inductiveautomation.com/t/get-role-from-system-user-rolestring/29851>\
**Category:** Ignition\
**Created:** [November 11, 2019, 4:30pm UTC](https://forum.inductiveautomation.com/t/get-role-from-system-user-rolestring/29851 "2019-11-11T16:30:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Neil\_B](https://avatars.discourse-cdn.com/v4/letter/n/e95f7d/32.png) [@Neil\_B](https://forum.inductiveautomation.com/u/Neil_B)\
**Post date:** [November 11, 2019, 4:30pm UTC](https://forum.inductiveautomation.com/t/get-role-from-system-user-rolestring/29851/1 "2019-11-11T16:30:09Z")

</div>

I’m trying to set a memory tag using the following expression on the system/client/RoleString which does not evaluate correctly.

The RoleString system tag is a list of strings, so I’m not sure how I would need to check the current users role against the system tag.

```auto
if ({[System]Client/User/RolesString} like 'Engineer', 1, 0)

```

---

<div class="post-metadata">

**Author:** ![bpreston](https://avatars.discourse-cdn.com/v4/letter/b/4af34b/32.png) [@bpreston](https://forum.inductiveautomation.com/u/bpreston)\
**Post date:** [November 11, 2019, 4:37pm UTC](https://forum.inductiveautomation.com/t/get-role-from-system-user-rolestring/29851/2 "2019-11-11T16:37:33Z")

</div>

I don’t believe this is working because ‘like’ isn’t a function in an expression. If I was use I would use the built in function [hasRole()](https://docs.inductiveautomation.com/display/DOC80/hasRole). From here you list the role your looking for, the user, and then the user source.

```auto
hasRole("Engineer", {[System]Client/User/Username},"user source")

```

If your looking at the current user and user source you should also be able to do just:

```auto
hasRole("Engineer")

```

It will return true if the user has the role and false if they don’t.

---

<div class="post-metadata">

**Author:** ![Neil\_B](https://avatars.discourse-cdn.com/v4/letter/n/e95f7d/32.png) [@Neil\_B](https://forum.inductiveautomation.com/u/Neil_B)\
**Post date:** [November 11, 2019, 4:42pm UTC](https://forum.inductiveautomation.com/t/get-role-from-system-user-rolestring/29851/3 "2019-11-11T16:42:17Z")

</div>

hasRole() worked perfect, thanks!

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [November 11, 2019, 4:43pm UTC](https://forum.inductiveautomation.com/t/get-role-from-system-user-rolestring/29851/4 "2019-11-11T16:43:02Z")

</div>

Clearing up a minor thing:  
`like` _is_ actually valid in the [expression language](https://docs.inductiveautomation.com/display/DOC80/Expression+Overview+and+Syntax#ExpressionOverviewandSyntax-Operators), but this is not the right use case for it; `like` would be used if you had a single string and wanted to check its content.
