--- title: "DN Actions" slug: "dn-actions" description: "This is a list of actions in RapidIdentity Connect that can be used for Distinguished Name (DN) LDAP attributes." tags: ["RapidIdentity ", "Connect", "Actions", "Distinguished Name (DN)"] updated: 2022-06-02T20:41:38Z published: 2022-06-02T20:41:38Z canonical: "help.rapididentity.com/dn-actions" --- > ## Documentation Index > Fetch the complete documentation index at: https://help.rapididentity.com/llms.txt > Use this file to discover all available pages before exploring further. # DN Actions ## DN Actions ### compareDN Compare two LDAP format DNs, returning 0 if dn1 == dn2, negative if dn1 < dn2, positive if dn1 > dn2, undefined if either dn is malformed | Property | Value | Description | | --- | --- | --- | | dn1* | text, expression, variable | the first DN | | dn2* | text, expression, variable | the second DN | | returnVariable | expression, variable | name of the variable to be assigned to the return value | ```actionscript # should return 0 cmp = compareDN("cn=1,ou=2,o=3,dc=4,dc=5,dc=6", "cn=1, ou=2, o=3,dc=4,dc=5,dc=6") # should return positive number cmp = compareDN("cn=1,ou=2,o=3,dc=4,dc=5,dc=6", "cn=1, ou=2, o=3,dc=4,dc=5") # should return negative number cmp = compareDN("cn=1, ou=2, o=3,dc=4,dc=5", "cn=1,ou=2,o=3,dc=4,dc=5,dc=6") ``` ### equalsDN Compare two LDAP format DNs for equality | Property | Value | Description | | --- | --- | --- | | dn1* | text, expression, variable | the first DN | | dn2* | text, expression, variable | the second DN | | returnVariable | expression, variable | name of the variable to be assigned to the return value | ```actionscript # should return true equals = equalsDN("cn=1,ou=2,o=3,dc=4,dc=5,dc=6", "CN=1, OU=2, O=3, DC=4, DC=5, DC=6") ``` ### getParentDN Get the parent DN of an LDAP format DN | Property | Value | Description | | --- | --- | --- | | dn* | text, expression, variable | the DN | | returnVariable | expression, variable | name of the variable to be assigned to the return value | ```actionscript # should return ou=2,o=3,dc=4,dc=5,dc=6 parent = getParentDN("cn=1,ou=2,o=3,dc=4,dc=5,dc=6") ``` ### getRDN Get the RDN of an LDAP format DN | Property | Value | Description | | --- | --- | --- | | dn* | text, expression, variable | the DN | | returnVariable | expression, variable | name of the variable to be assigned to the return value | ```actionscript # should return cn=1 parent = getRDN("cn=1,ou=2,o=3,dc=4,dc=5,dc=6") ``` ### isChildOfDN Check if an LDAP format DN is a child of another DN | Property | Value | Description | | --- | --- | --- | | dn* | text, expression, variable | the child DN | | parentDn* | text, expression, variable | the parent DN | | returnVariable | expression, variable | name of the variable to be assigned to the return value | ```actionscript # should return true isChild = isChildOfDN("cn=1,ou=2,o=3,dc=4,dc=5,dc=6", "ou=2,o=3,dc=4,dc=5,dc=6") # should return false isChild = isChildOfDN("cn=1,ou=2,o=3,dc=4,dc=5,dc=6", "o=3,dc=4,dc=5,dc=6") ``` ### isDescendantOfDN Check if an LDAP format DN is a descendant of another DNCheck if an LDAP format DN is a descendant of another DN | Property | Value | Description | | --- | --- | --- | | dn* | text, expression, variable | the descendant DN | | ancestorDn* | text, expression, variable | the ancestor DN | | returnVariable | expression, variable | name of the variable to be assigned to the return value | ```actionscript # should return true isChild = isChildOfDN("cn=1,ou=2,o=3,dc=4,dc=5,dc=6", "ou=2,o=3,dc=4,dc=5,dc=6") # should return true isChild = isChildOfDN("cn=1,ou=2,o=3,dc=4,dc=5,dc=6", "o=3,dc=4,dc=5,dc=6") # should return false isChild = isChildOfDN("cn=1,ou=2,o=3,dc=4,dc=5,dc=6", "cn=2,ou=2,o=3,dc=4,dc=5,dc=6"") ``` ### splitDN Split an LDAP format DN into an array of RDNs. | Property | Value | Description | | --- | --- | --- | | dn* | text, expression, variable | the DN | | limit | expression, variable | the maximum size of the array to return | | returnVariable | expression, variable | name of the variable to be assigned to the return value | ```actionscript # should return ["cn=1", "ou=2","o=3", "dc=4", "dc=5", "dc=5"] rdns = splitDN("cn=1,ou=2,o=3,dc=4,dc=5,dc=5") ``` ### splitRDN Split an LDAP format RDN into an array of name/value pairs. | Property | Value | Description | | --- | --- | --- | | rdn* | text, expression, variable | the RDN | | returnVariable | expression, variable | name of the variable to be assigned to the return value | ```actionscript # should return [["cn", "x"], ["ou","y"], ["mail", "z"]] split = splitRDN("cn=x+ou=y+mail=z") ```