Announcement

Collapse
No announcement yet.

Set default Name field to Unique

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Set default Name field to Unique

    I do apologies in advanced if this has been answered, however I have not been able to find the thread related to my question.

    I am creating a Base plus entity for stock control. I would like to use the default Name field as the Serial number. This obivously has to be unique to prevent duplicates on inventory control.

    Now I have successfully used the "unique": true within the json file for a custom field, but if I add that on the default Name field it does not work.

    Below is the copy of InventoryControl.json in Custom..//metadata/entityDefs
    ​​

    {

    "fields": {

    "name": {

    "type": "varchar",

    "required": true,

    "trim": true,

    "unique": true,

    "pattern": "$noBadCharacters",

    "options": []

    },

    "description": {

    "type": "text"

    },

    "createdAt": {

    "type": "datetime",

    "readOnly": true

    },

    "modifiedAt": {

    "type": "datetime",

    "readOnly": true

    },

    "createdBy": {

    "type": "link",

    "readOnly": true,

    "view": "views/fields/user"

    },

    "modifiedBy": {

    "type": "link",

    "readOnly": true,

    "view": "views/fields/user"

    },

    "assignedUser": {

    "type": "link",

    "required": true,

    "view": "views/fields/assigned-user"

    },

    "teams": {

    "type": "linkMultiple",

    "view": "views/fields/teams"

    },

    "serialNumControl": {

    "type": "varchar",

    "required": true,

    "maxLength": 150,

    "unique": true,

    "options": [],

    "isCustom": true

    }

    },
    serialNumControl is the one I have applied unique: true and it is working. However with name it does not apply.

  • #2
    Try to add ("isCustom": true) to the name field as it would allow the field to be customised.
    Rabii
    Web Dev

    Comment


    • #3
      Originally posted by rabii View Post
      Try to add ("isCustom": true) to the name field as it would allow the field to be customised.
      Unfortunately no luck, still not making the field unique.

      Comment

      Working...
      X