【发布时间】:2013-06-05 14:20:57
【问题描述】:
我想知道如何创建只读组 + 喜欢 + 评论,并且无法为除管理员和所有者之外的成员发帖 * 如何在本群发帖使用触发器?
我试过了,还是不行:
trigger N_GroupReadOnly on FeedItem (before insert) {
ID groupId = [Select Id from CollaborationGroup where Name = 'Group_ReadOnly'].Id;
CollaborationGroup ownerId = [Select OwnerId From CollaborationGroup Where Name = 'Group_ReadOnly'];
for(FeedItem item : trigger.new){
if((item.ParentId == groupId) && (item.InsertedById != ownerId.OwnerId)){
system.debug('you can not add post in this group');
alert("you can not add post in this group");
delete item ;
return;
}
else{
insert item;
}
}
}
谢谢。
【问题讨论】:
标签: salesforce apex-code salesforce-chatter