function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
bhagibhagi 

how we assign a task to profiles

Hi all,

      when i share something in chatter free user it automatically creats a task  to standard platform user profile

i write the trigger its save but its not creating a task to standard platform user

 

List<User> users = [SELECT Id FROM User where Profile.Name = 'Standard Platform User' Limit 1];
        if(users.size() > 0){
            User usr = users.get(0);
        for(FeedItem fItem : fItems){
if(fItem.Body != null && groups.size() > 0 && (fItem.Body.toUpperCase().Contains('*')) || (fItem.Body.toUpperCase().Contains('#HOS'))){
                Task newTask = new Task();
                newTask.OwnerId =usr.Id;
                if(fItem.Body.toUpperCase().Contains('*')){
                    newTask.Subject = groupMap.get(fItem.ParentId)+' * '+userInfo.getFirstName();
                    newTask.Description = fItem.Body.subString(4,fItem.Body.length());
                    newTask.ActivityDate = System.today()+ 2;
                }else if(fItem.Body.toUpperCase().Contains('#HOS')){
                    newTask.Subject = groupMap.get(fItem.ParentId)+' #HOS '+userInfo.getFirstName();
                    newTask.Description = fItem.Body.subString(4,fItem.Body.length());
    }                newTask.ActivityDate = System.today()+ 2;

can you suggest me anyone??

 

Thanks&Regards

bhagi

Jia HuJia Hu
add:
insert newTask;