I have a Number field which I want to update using workflow. But since this field has unique option checked so how can I generate unique value in workflow? any thoughts?

2 Answers 2


We all know very well that salesforce ID is unique and hence you may use formula like 'UNIQ-'+VALUE(Id)

So your external Id will be UNIQ-+salesforceID(18 digit)

  • 1
    Awesome....even I am surprised why couldn't think of that. Thanks Mohit
    – doga
    Commented Nov 23, 2012 at 4:43
  • Thanks it happens and therefore we have stackexchange and salesforce community to help us. Commented Nov 23, 2012 at 4:52
  • 1
    I guess we both forgot that field is number field whereas salesforce record id is of string type we can't assign it.
    – doga
    Commented Nov 23, 2012 at 5:39
  • You can always convert back string to to number .Use Value function.Updated the answer Commented Nov 23, 2012 at 5:48

As you have mentioned in Mohith's answer you can't populate a number field with an Id (or String).

What I would suggest is create an Auto Number field on the Object with the format {0} (This is a number only format) This will guarantee a unique number for every record. Then you will be able populate your unique number field with the auto number value.

It sounds like the unique number field is not well designed, I would recommend reconsidering why the Number is unique at all.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .