| 
  | 
Whitebeam Template Reference Documentation
  | 
 Contact Template 
createOU()
 Creates an OU entity 
 See Also 
rb.contact.OUInfo rb.contact.modifyOU rb.contact.link rb.contact.remove Syntax 
number = rb.contact.createOU(values, initialParent) 
 Parameters 
The 'createOU' method takes 2 parameters: 
 | Name  |  Type/Value  |  Range/Length  |  Description	 |   | values | struct OUData | see definition  | Required. New community OU info |  | initialParent | number | poitive integer  | Optional, default = 0 The initial OU parent for this OU. The valid ID of the parent OU, or 0 (root) to indicate that the OU has no parent
       |    
 Results 
The 'createOU' method returns  number: 
 | Type/Value  |  Range/Length  |  Description   |   
| number | 
-1, or positive integer | OU ID of the created OU, or -1 if the OU  couldn't be created.
       |  
  
 Remarks  If no uName is supplied in the passed data structure then a long machine generated text string is inserted into this field to guarantee uniqueness A common reason for failure of the create operation is a duplicate uName value already existing in another Individual, Community, or OU entry.  Example  The following creates a new OU for "Mega Corp", and makes the user with uName "fred" a member of the new OU:
 
	  var mega = new Object;
	  mega.name = "Mega Corp";
	  friends.description = "Mega Corp of Delaware Inc";
	  var newID = rb.contact.createOU(mega);
	  if(newID != null && (user = individualInfo(-1, "fred")))
	  rb.contact.link(user.ID, mega.ID);
	  | 
 
 
 | 
| 
 (loadtime : 68ms)  |