In Cloudkit Dashboard, I select Record Type, Edit Indexes, then I select Add Basic Index. I see in the dropdown createTime, createdBy, eTag, modTime, modifiedBy, recordID and the record fields. I do not see recordName in the dropdown( Attached screenshot). Without creating index on recordName, I cannot query the record in cloudKit Dashboard. I get error: Field 'recordName' is not marked queryable How to create index on recordName?

I ran into this same issue and solved it by adding ___recordID as a queryable index. When it is added to the list of indexes, the field changes to recordName.
To add this as a queryable index, go to the Schema Section -> Indexes, and click Add Basic Index.
Here is a visual of how to do it in the dashboard. Pay attention to the photos with steps 8) and 18).
FYI after doing the below I ran into another issue where I got an error
Field 'createdBy' is not marked queryable
I'm not sure which one is createdBy but to fix it I had to follow the same exact steps below except on step 14), I choose createdUserRecordName and all the other system generated field names like __etag etc and then had to make sure each one was 15 )queryable. I had to press 16) Save Changes for each one separately.
A- Select 1) Databases > 2) click the dropdown arrow 3) select your iCloud name from 4) Xcode


B- Next select 5) Record (press the drop down arrow) > 6) Schema > Record Types (after Record Types highlights click anywhere off of the screen)


C- Next under 7) Record Type click Users or whatever the name of your record type is

D- On the next screen you will will see 8) the recordName field is set to None under Single Field Indexes. To change it and fix the issue press 9) Record Types to go back

E- After you went back a page, on that same page 10) press the down arrow next to Records > then 11) select Schema > Indexes (after Indexes highlights click anywhere off of the screen)


F- Next under 12) Record Type click Users or whatever the name of your record type is

G- On this page, at the bottom, 13) click Add Basic Index and then select 14) recordName


H- On that same page, make sure that 15) the Index Type is Queryable. Then press 16) Save Changes. After it saves, press 17) Indexes to go back

Follow steps 5) to 8) again, but this time 18) the recordName field will be set to **Queryable** under Single Field Indexes

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With