コミュニティユーザの判定方法
SELECT Name,toLabel(UserType),AccountId,ContactId,IsPortalEnabled FROM User
------------------------------------------------------------------------------
SELECT Name,toLabel(UserType),AccountId,ContactId,IsPortalEnabled
FROM User
where UserType = 'PowerPartner'
------------------------------------------------------------------------------
select masterLabel,description,activeVersionNumber from FlowDefinition
------------------------------------------------------------------------------
select Id,Name,UserType From proFile
------------------------------------------------------------------------------
取引先責任者より、パートナユーザの公開グループ取得、共有設定
⓵パートナユーザ判定
select id,Username,AccountId,Account.Name,ContactId,UserType,PortalRole,UserRoleId
from user
where ContactId= '003XXXXXXX'
------------------------------------------------------------------------------
⓶パートナユーザの取引先名とロールグループ名一致のため、検索できる
List<Group> roleGroups = [
Select Id,Related.Name
From Group
Where Type= 'Role' And Related.Name Like '%Account.Name%'
];
// Related.Name = Account.Name + ' パートナー ユーザ'
------------------------------------------------------------------------------
⓷共有設定
List<ContactShare> conShareList = new List<ContactShare>();
for(Contact contact :ContactList){
ContactShare conShare = new ContactShare();
conShare.ContactId = contact.Id;
conShare.UserOrGroupId = roleGroups[0].Id;
conShare.ContactAccessLevel = 'Edit';
conShareList.add(conShare);
}
insert conShareList;
// ContactList:対象取引先責任者を既存外部ユーザのグループに共有する