Hi, I would like to add filter option to the list of Contacts based on which I could filter only contacts with specific number of linked opportunities.
I tried to re-use solution for "hasPortalUser" filter option so I created "hasOpportunity" boolean field in Contact entity and added following piece of code into /metadata/entityDefs/Contact.json. But this would work only if there was 1:1 relation. How should I update the code to make it work with collection? Is there any documentation I could browse to check all options I could use?
"hasOpportunity": {
"type": "bool",
"notStorable": true,
"readOnly": true,
"mergeDisabled": true,
"customizationDefaultDisabled": true,
"customizationReadOnlyDisabled": true,
"foreignAccessDisabled": true,
"select": {
"select": "IS_NOT_NULLopportunity.id)",
"leftJoins": [["opportunity", "opportunity"]]
},
"where": {
"= TRUE": {
"whereClause": {
"portalUser.id!=": null
},
"leftJoins": [["opportunity", "opportunity"]]
},
"= FALSE": {
"whereClause": {
"portalUser.id=": null
},
"leftJoins": [["opportunity", "opportunity"]]
}
},
"order": {
"order": [
["portalUser.id", "{direction}"]
],
"leftJoins": [["opportunity", "opportunity"]],
"additionalSelect": ["opportunity.id"]
}
},
Many thanks
I tried to re-use solution for "hasPortalUser" filter option so I created "hasOpportunity" boolean field in Contact entity and added following piece of code into /metadata/entityDefs/Contact.json. But this would work only if there was 1:1 relation. How should I update the code to make it work with collection? Is there any documentation I could browse to check all options I could use?
"hasOpportunity": {
"type": "bool",
"notStorable": true,
"readOnly": true,
"mergeDisabled": true,
"customizationDefaultDisabled": true,
"customizationReadOnlyDisabled": true,
"foreignAccessDisabled": true,
"select": {
"select": "IS_NOT_NULLopportunity.id)",
"leftJoins": [["opportunity", "opportunity"]]
},
"where": {
"= TRUE": {
"whereClause": {
"portalUser.id!=": null
},
"leftJoins": [["opportunity", "opportunity"]]
},
"= FALSE": {
"whereClause": {
"portalUser.id=": null
},
"leftJoins": [["opportunity", "opportunity"]]
}
},
"order": {
"order": [
["portalUser.id", "{direction}"]
],
"leftJoins": [["opportunity", "opportunity"]],
"additionalSelect": ["opportunity.id"]
}
},
Many thanks
Comment