跳到主要内容

Remove

移除具有指定名称的角色。

语法

expression.Remove(name, delegateRole);

expression - 表示 ApiFormRoles 类的变量。

参数

名称必需/可选数据类型默认值描述
name必需string要移除的角色名称。
delegateRole可选string所有绑定到此角色的表单将被委托给的角色名称。

返回值

boolean

示例

此示例展示如何移除角色。

let doc = Api.GetDocument();
let roles = doc.GetFormRoles();
roles.Add("Customer");
roles.Add("Seller");
roles.Remove("Anyone");
let paragraph = doc.GetElement(0);
roles.GetAllRoles().forEach(role => {
paragraph.AddText(role);
paragraph.AddLineBreak();
});