In one of my apps I’m trying to have the app create 2 custom objects (v2). To do that I’m including a requirements.json file in my app and specifying the creation of the 2 objects. When you use custom objects by default 2 standard fields get created, Name and ExternalId. The issue I am running into is that when I try to specify the autoincrement settings for Name or add a description for ExternalId the app fails to install. I’m assuming because the custom object believes I’m asking for a duplicate field to be set where as all I’m trying to do is set the autoincrement on the Name and a description on the ExternalId. Things that I can easily do in the UI but since this is an app I cannot go the UI route.
I have code similar to this:
{
"custom_objects_v2": {
"objects": [
{
"key": "object_1",
"include_in_list_view": false,
"title": Object 1",
"title_pluralized": "Object 1",
"description": "object 1 description"
},
{
"key": "object_2",
"include_in_list_view": false,
"title": Object 2",
"title_pluralized": "Object 2",
"description": "object 2 description"
}
],
"object_fields": [
{
"object_key": "object_1",
"key": "standard::name",
"title": "Name",
"type": "text",
"properties": {
"autoincrement_enabled": true,
"autoincrement_prefix": "Name1-",
"autoincrement_padding": 9,
"autoincrement_next_sequence": 1
}
},
{
"object_key": "object_1",
"key": "standard::external_id",
"title": "External ID",
"description": "I want to add a description",
"type":"text"
},
{
"object_key": "object_2",
"key": "standard::name",
"title": "Name",
"type": "text",
"properties": {
"autoincrement_enabled": true,
"autoincrement_prefix": "Name2-",
"autoincrement_padding": 9,
"autoincrement_next_sequence": 1
}
},
{
"object_key": "object_2",
"key": "standard::external_id",
"title": "External ID",
"description": "I want to add a description",
"type":"text"
},
{
"object_key": "object_2",
"key": "field 1...n",
"title": "Field 1 ...n",
"description": "all the other fields represented ad this single object.",
"type":"text"
}
],
"object_triggers": []
}
}The error I get when trying to install:
Custom objects install failed: Mysql2::Error: Duplicate entry '26585059-standard::name-CustomObject-\x01\x9FNE\xDA\xDF\xA2Mt\xC' for key 'cf_fields.account_key_owner_co'
You can replace standard::name with standard::externalid if you remove the Name fields but leave the ExternalId ones.
Now if I remove the Name and ExternalId fields from the requirements.json completely the install works as it should. but that doesn’t get me to where I need to be.
So the question is, within the requirements.json how would I enable autoincrement on the name field and possibly add a description to the externalId field. Not having the description on the externalId is not the end of the world but I would like to have both if possible.
Thanks in advance!
