QuickBaseAdmi10
12 months agoQrew Cadet
API_GetUserRole | Multiple Roles
Hello,
Hopefully this is simple for a jinja2 master.
I have a pipeline that is running the API_GetUserRole.
I have everything working, except for when a user has multiple roles. When that happens, I get a blank value for role_id and role_name. I shortened the jinja2 to pull all data so I can see what is happening. Here is the jinja2 to pull everything:
{{ b.json.qdbapi.user.roles }}
Here is the output on the QuickBase record:
OrderedDict([(u'role', [OrderedDict([(u'@id', u'45'), (u'name', u'Claims - Processor (Incela/Hawaii Legacy)'), (u'access', OrderedDict([(u'@id', u'3'), ('#text', u'Basic Access')]))]), OrderedDict([(u'@id', u'55'), (u'name', u'EUTF Add/Edit'), (u'access', OrderedDict([(u'@id', u'3'), ('#text', u'Basic Access')]))])])])
This is what I hope to accomplish and see within the record:
Role_ID: 45 ; 55
Role_Name: Claims - Processor (Incela/Hawaii Legacy) ; EUTF Add/Edit
This was my last attempt at Jinja which output the value of "No roles assigned":
{% if b.json.qdbapi.user.roles %}
{% if b.json.qdbapi.user.roles.role %}
{{ b.json.qdbapi.user.roles.role['@id'] }}
{% else %}
Role ID not available
{% endif %}
{% else %}
No roles assigned
{% endif %}
Any ideas?
------------------------------
QuickBase Administrator2
------------------------------