Novell Home

Generating Unique 8-Character CN's

Novell Cool Solutions: Tip

Digg This - Slashdot This

Posted: 23 May 2007
 

Problem

A Forum reader recently asked:

"I'm using IDM 3.5 and looking for the best method to generate a CN value that includes:

  • A maximum length of 8 characters
  • The first character of the given name
  • The first character of the initials
  • The surname

The tie-breaker rule is to add a number to the end, and when adding a number to the end it must still be a maximum of 8 characters."

And here's the response from Father Ramon ...

Solution

The example below will give you a 1-digit counter after an initial collision. If you want a counter even when no collision occurs, then get rid of the first pattern. If you want more than one digit, change the counter digits and adjust the substring length in the pattern to match.

<do-set-local-variable name="proposed" scope="policy">
   <arg-string>
     <token-substring length="8">
       <token-substring length="1">
         <token-attr name="Given Name"/>
       </token-substring>
       <token-substring length="1">
         <token-attr name="Inititials"/>
       </token-substring>
       <token-attr name="Surname"/>
     </token-substring>
   </arg-string>
</do-set-local-variable>
<do-set-op-dest-dn>
   <arg-dn>
     <token-unique-name counter-digits="1" counter-pattern="last" 
counter-use="always" name="CN" on-unavailable="error">
       <arg-string>
         <token-local-variable name="proposed"/>
       </arg-string>
       <arg-string>
         <token-substring length="7">
           <token-local-variable name="proposed"/>
         </token-substring>
       </arg-string>
     </token-unique-name>
   </arg-dn>
</do-set-op-dest-dn>


Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

© 2014 Novell