+ Start a Discussion
nelloCnelloC 

Thread Id formula

I was looking on here for a formula that generates a thread id correctly but couldn't find anything. So I've come up with one that does the job. I thought someone else might find this useful.

 

 

"ref:"&LEFT( $Organization.Id , 4 )&
IF(BEGINS(RIGHT($Organization.Id,11), '0000000'), RIGHT($Organization.Id,4), 
 IF(BEGINS(RIGHT($Organization.Id,11), '000000'), RIGHT($Organization.Id,5), 
  IF(BEGINS(RIGHT($Organization.Id,11), '00000'), RIGHT($Organization.Id,6), 
   IF(BEGINS(RIGHT($Organization.Id,11), '0000'), RIGHT($Organization.Id,7), 
    IF(BEGINS(RIGHT($Organization.Id,11), '000'), RIGHT($Organization.Id,8),
     IF(BEGINS(RIGHT($Organization.Id,11), '00'), RIGHT($Organization.Id,9),
      IF(BEGINS(RIGHT($Organization.Id,11), '0'), RIGHT($Organization.Id,10), RIGHT($Organization.Id,11)
      )
     )
    )
   )
  )
 )
)
&"."&LEFT( Id , 4 )&
IF(BEGINS(RIGHT(Id,11), '0000000'), RIGHT(Id,4), 
 IF(BEGINS(RIGHT(Id,11), '000000'), RIGHT(Id,5), 
  IF(BEGINS(RIGHT(Id,11), '00000'), RIGHT(Id,6), 
   IF(BEGINS(RIGHT(Id,11), '0000'), RIGHT(Id,7), 
    IF(BEGINS(RIGHT(Id,11), '000'), RIGHT(Id,8),
     IF(BEGINS(RIGHT(Id,11), '00'), RIGHT(Id,9),
      IF(BEGINS(RIGHT(Id,11), '0'), RIGHT(Id,10), RIGHT(Id,11)
      )
     )
    )
   )
  )
 )
)
&":ref"