# 组织信息

### &#x20;**1.查询组织的下级：listSubUnit函数说明**

| var unitList=this.org.listSubUnit (name,\[true\|false]);                                                                                        |                     |                                                                     |
| ----------------------------------------------------------------------------------------------------------------------------------------------- | ------------------- | ------------------------------------------------------------------- |
| **参数说明**                                                                                                                                        | <p>name : （String   | Array）必选，组织唯一编码</p><p>nested     布尔  true嵌套下级；false直接下级；默认false</p> |
| **返回值**                                                                                                                                         | unitArray 返回组织的对象数组 |                                                                     |
| **脚本示例**                                                                                                                                        |                     |                                                                     |
| <p>var dn = "人社事业部@e0c84b01-ef35-482f-946b-93e040848af5\@U";</p><p>var unitArray = this.org.listSubUnit(dn);</p><p>return unitArray.length;</p> |                     |                                                                     |

### &#xD;2\.  **查询组织的上级：listSupUnit**

| **函数说明**                                                                                                                                        | var unitList=this.org.listSupUnit(name,\[true\|false]); |                                                                     |
| ----------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------------------- |
| **参数说明**                                                                                                                                        | <p>name : （String                                       | Array）必选，组织唯一编码</p><p>nested     布尔  true嵌套上级；false直接上级；默认false</p> |
| **返回值**                                                                                                                                         | unitArray 返回组织的对象数组                                     |                                                                     |
| **脚本示例**                                                                                                                                        |                                                         |                                                                     |
| <p>var dn = "人社事业部@e0c84b01-ef35-482f-946b-93e040848af5\@U";</p><p>var unitArray = this.org.listSupUnit(dn);</p><p>return unitArray.length;</p> |                                                         |                                                                     |

### &#xD;**3.根据个人身份获取组织：getUnitByIdentity**

| **函数说明**                                                                                                                                                  | var unitList=this.org.getUnitByIdentity (name,flag); |                                                                                                           |
| --------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
| **参数说明**                                                                                                                                                  | <p>name : （String                                    | Array）必选，个人唯一编码</p><p>flag：</p><p>数字 -- 表示获取第几层的组织</p><p>字符串 -- 表示获取指定类型的组织</p><p>空字符串 -- 表示获取直接所在的组织</p> |
| **返回值**                                                                                                                                                   | unitArray 返回组织的对象数组                                  |                                                                                                           |
| **脚本示例**                                                                                                                                                  |                                                      |                                                                                                           |
| <p>var dn = "李义@5d10c11e-54cd-458d-9c34-5ba1a371a4d9\@I";</p><p>var unitArray =  this.org.getUnitByIdentity(dn, "一级部门");</p><p>return unitArray.name;</p> |                                                      |                                                                                                           |

### &#xD;**4.列出身份所在组织的所有上级组织：listAllSupUnitWithIdentity**

| **函数说明**                                                                                                                                                             | var unitList= this.org.listAllSupUnitWithIdentity (name); |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------- |
| **参数说明**                                                                                                                                                             | name : （String\|Array）必选，身份唯一编码                           |
| **返回值**                                                                                                                                                              | unitArray 返回组织的对象数组                                       |
| **脚本示例**                                                                                                                                                             |                                                           |
| <p>var dn = "李义@5d10c11e-54cd-458d-9c34-5ba1a371a4d9\@I";</p><p>var unitArray =  this.org.listAllSupUnitWithIdentity (dn);</p><p>return unitArray.length;       </p> |                                                           |

### &#xD;5\.  **获取人员所在的所有组织：listUnitWithPerson**

| **函数说明**                                                                                                                                                | var unitList= this.org.listUnitWithPerson (name); |
| ------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------- |
| **参数说明**                                                                                                                                                | name : （String\|Array）必选，身份唯一编码                   |
| **返回值**                                                                                                                                                 | unitArray 返回组织的对象数组                               |
| **脚本示例**                                                                                                                                                |                                                   |
| <p>var dn = "李义@5d10c11e-54cd-458d-9c34-5ba1a371a4d9\@I";</p><p>var unitArray =  this.org.listUnitWithPerson (dn);</p><p>return unitArray.length;  </p> |                                                   |

### &#xD;6.**列出个人所在组织的所有上级组织：listAllSupUnitWithPerson**

| **函数说明**                                                                                                                                                    | var unitList= this.org.listAllSupUnitWithPerson (name); |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- |
| **参数说明**                                                                                                                                                    | name : （String\|Array）必选，个人唯一编码                         |
| **返回值**                                                                                                                                                     | unitArray 返回组织的对象数组                                     |
| **脚本示例**                                                                                                                                                    |                                                         |
| <p>var dn = "李义@5d10c11e-54cd-458d-9c34-5ba1a371a4d9\@I";</p><p>var unitArray =  this.org.listAllSupUnitWithPerson (dn);</p><p>return unitArray.length;</p> |                                                         |

### &#xD;7.**根据组织属性获取所有符合的组织：listUnitWithAttribute**

| **函数说明**                                                                                                                                         | var unitList= this.org.listUnitWithAttribute(name,attribute); |                                     |
| ------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------- | ----------------------------------- |
| **参数说明**                                                                                                                                         | <p>name : （String                                             | Array）属性名</p><p>attribute   属性值</p> |
| **返回值**                                                                                                                                          | unitArray 返回组织的对象数组                                           |                                     |
| **脚本示例**                                                                                                                                         |                                                               |                                     |
| <p>var name= ""; var attribute = "";</p><p>var unitArray =  this.org.listUnitWithAttribute (name,attribute );</p><p>return unitArray.length;</p> |                                                               |                                     |

### &#xD;8\.  **根据组织职务获取所有符合的组织：listUnitWithDuty**

| **函数说明**                                                                                                                                      | var unitList= this.org. listUnitWithDuty (name,id); |                                            |
| --------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------- | ------------------------------------------ |
| **参数说明**                                                                                                                                      | <p>name : （String                                   | Array）组织职务名</p><p>id    身份id（也可以是身份对象）</p> |
| **返回值**                                                                                                                                       | unitArray 返回组织的对象数组                                 |                                            |
| **脚本示例**                                                                                                                                      |                                                     |                                            |
| <p>var name = "总经理";</p><p>var id = "身份id";</p><p>var unitArray = this.org.listUnitWithDuty (name,id);</p><p>return unitArray.length;    </p> |                                                     |                                            |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://o2oa.gitbook.io/course/ping-tai-shi-shi/zu-zhi-guan-li/untitled/untitled-1.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
