write a record and increase the number in a field by one

  • 1
  • Question
  • Updated 6 months ago
I have a field in a table that started off with 1.  Each added record to the object I want to increase by 1.  How can I auto increase by 1.  It cannot be the autonumber field as I used it for a unique name.
Photo of Bill Fox

Bill Fox

  • 8,880 Points 5k badge 2x thumb

Posted 6 months ago

  • 1
Photo of Louis Skelton

Louis Skelton

  • 5,522 Points 5k badge 2x thumb
Hi Bill!

Could you create a Ui-Only formula (number) field which has a formula:
{{$Model.YOURTABLEMODELNAME.data.length}} + 1
and then use a global action to create the record in the table and use the above Ui-Only field as a default value for the field in question?

Just a thought - not tested.
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,828 Points 20k badge 2x thumb
I would push on the AutoNumber features in the database.  I don't really understand what you mean by needing a Unique name.  The SFDC setup allows you to specify a prefix to your autonumber - is that not unique enough?  

Otherwise the solution Louis provided is a good one.