Commit 082d36e8 authored by Andrei Mondoc's avatar Andrei Mondoc
Browse files

ammend api4 profile query and filter out reserved profiles

parent e9363cf1
...@@ -22,14 +22,19 @@ const SelectProfileControl = ({ gid, setAttributes }) => { ...@@ -22,14 +22,19 @@ const SelectProfileControl = ({ gid, setAttributes }) => {
useEffect(() => { useEffect(() => {
CRM.api4('UFGroup', 'get', { CRM.api4('UFGroup', 'get', {
select: ['title', 'group_type'], select: ['title', 'group_type', 'is_reserved'],
where: [ where: [
['is_active', '=', '1'], ['is_active', '=', '1'],
['is_reserved', '=', '0'],
], ],
}).then((result) => { }).then((result) => {
if (!result && !result.length) return if (!result && !result.length) return
// Since is_reserved can be either
// true|false|null and I cannot seem
// to make API4 to return the appropriate
// (already) filtered result, filter it here.
result = result.filter((item) => !item.is_reserved)
const options = result.map((ufGroup) => { const options = result.map((ufGroup) => {
return { return {
...ufGroup, ...ufGroup,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment