Community
Showing results for 
Search instead for 
Do you mean 
Reply

Which field property does $filter check

Copper Contributor
Posts: 33
Country: Germany

Which field property does $filter check

[ Edited ]

So, here's where I'm at. I'm trying to filter for a field, and, I'm starting to be unsure about which property I'm supposed to look at here. Through

/api/metadada/{recordtype}/fields

I get

"name": "customFields/state", "columnName": "BUSINESS_STATE", "recordType": "Kontakt", "aliasName": "STATE", "columnType": "Virtual", "displayName": "Bundesland\\Kanton", "tableName": "TBL_CONTACT",

 

I'd love to filter for the value in "displayName", as that's exactly what I'd see if I were to check through Act! itself. But that's pretty sure not what the WebAPI is doing, is it?

What would be the correct property for me to check on?

Copper Contributor
Posts: 33
Country: Germany

Re: Which field property does $filter check

I hope I worded my question in a way it makes sense. Any feedback?
Administrator
Posts: 1,372
Country: United_Kingdom

Re: Which field property does $filter check

Hi Thomas,

 

Maybe I'm not understanding the question - but you should be able to filter the request on any of the fields in the response.

 

Eg: If I wanted to only return metadata about my databases user10 field, I can make the request:

 

.../act.web.api/api/metadata/Contact/fields?$filter=displayName eq 'User 10'

 

 

And the response I get is:

 

[
	{
		"id": "db2b60bd-9b1b-4255-8359-32e9177564b4",
		"name": "customFields/user10",
		"columnName": "USER10",
		"recordType": "Contact",
		"aliasName": "USER10",
		"columnType": "Physical",
		"displayName": "User 10",
		"tableName": "TBL_CONTACT",
		"type": "Character",
		"length": 64,
		"scale": 0,
		"defaultValue": null,
		"fieldFormat": "",
		"isAllowBlank": true,
		"isCustom": false,
		"isNullable": true,
		"isPrimary": false,
		"isReadOnly": false,
		"isTracked": false,
		"isVirtual": false,
		"createDate": "2012-01-19T15:23:16+00:00",
		"editDate": "0001-01-01T00:00:00+00:00",
		"changeEvent": "",
		"enterEvent": "",
		"leaveEvent": "",
		"picklist": null
	}
]

or alternatively if I wanted to get the name of all mandatory fields:

 

.../act.web.api/api/metadata/Contact/fields?$filter=isAllowBlank eq false&$select=displayName

 

which would returns the field display names as expected.

 

Copper Contributor
Posts: 33
Country: Germany

Re: Which field property does $filter check

Yeah, clearly I didn't descripe that very well Smiley Wink

I only posted the result of the metadata/fields to illustrate what I'm talking about.

 

So, what I'm actually after is:

/Companies?$filter=customFields/someFieldName eq 'someValue' and customFields/someOtherFieldName eq 'someValueOrAnother'

and the thing is, that doesn't seem to run against the "displayName" of the fields. Is that really the case?

Highlighted
Administrator
Posts: 1,372
Country: United_Kingdom

Re: Which field property does $filter check

[ Edited ]

Ah I see, I think the API does not use the display name, but the "name".

 

The property you need to use to filter is the exact name of the property as it is returned in the contact object, but my testing shows that you don't need to specify the customFields sub-entity.

 

eg:

 

When i request a contact I get:

 

{
"id": "32ad3724-1e58-4028-a163-0006033747e4",

[...],

"customFields": {
    "user10": null,
    "spouse": null,
    "user7": "321",
    "no mailing": "Changetest",
    "news1": "False",
    "test": "TestChange",
    "cb1": "False"
},
[...]
}

 

 

So if I want to filter on my news1 field, I would write my filter as simply "$filter=news1 eq true"

 

I've raised the questions with the API team as to exactly where the API gets these property names from - and why the customFields subentity isn't required in filters. I'll let you know if they provide any info.