Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 143529

Can not assign task to a team entity

$
0
0

Hi Guys, I am creating a plugin, where i just need to assign a task to a team, the plugin tiggers an error and it is registered in the post event and a Create message name to a custom entity. I have debugged it and it gives this error - "System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]: Principal team (Id=9d666867-b59b-e811-8140-70106faaf8c1, type=9) is missing prvReadActivity privilege (Id=650c14fe-3521-45fe-a000-84138688e45d) (Fault Detail is equal to Exception details: ErrorCode: 0x80042F0A".

My code is below:

if(context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity)
            {
                Entity travelDetail = (Entity)context.InputParameters["Target"];

                if(travelDetail.LogicalName != "gg_traveldetail") { return; }

                try
                {
                    QueryByAttribute teamQuery = new QueryByAttribute("team");
                    teamQuery.AddAttributeValue("name", "Travel Consultants");

                    EntityCollection retrievedTeam = service.RetrieveMultiple(teamQuery);

                    Entity travelConsultantTeam = (Entity)retrievedTeam.Entities[0];

                    Guid travelconId = travelConsultantTeam.Id;


                    Entity task = new Entity("task");

                    task.Attributes["subject"] = "New Travel Booking Created";
                    task.Attributes["ownerid"] = new EntityReference(travelConsultantTeam.LogicalName, travelconId);
                    task.Attributes["description"] = "A new travel booking has been created for a staffing role.";

                    if (context.OutputParameters.Contains("id"))
                    {
                        Guid regardingobjectid = new Guid(context.OutputParameters["id"].ToString());
                        string regardingobjectidType = "gg_traveldetail";

                        task.Attributes["regardingobjectid"] =
                        new EntityReference(regardingobjectidType, regardingobjectid);
                    }

                    service.Create(task);

Thanks for the help guys.


Viewing all articles
Browse latest Browse all 143529

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>