0

I have a requirement that involves an email service. In the email service I should be Creating a Task (Done) and creating an email message and put it as a related Object Under the Task that is created.

Apparently, upon testing it I always have an error . I have tried to do the follow codes:

 em.ParentId = taskId;
 em.RelatedToId = taskId;
 em.ActivityId = taskId;

The ParentId is throwing an error because Task isn't part of the list of objectsthat ParentId has a look up to.

RelatedToId Throws me this error: FIELD_INTEGRITY_EXCEPTION, Related To ID: id value of incorrect type: 00TBo000000SesBMAS: [RelatedToId]

The Activity Id Throws me this error: INSUFFICIENT_ACCESS_OR_READONLY, You cannot edit this field: [ActivityId]

Anythoughts about this ?

2 Answers 2

0

As per the emailMessage object documentation ,

ParentId refers to the case object alone.

RelatedToId refer to other standard objects like below and task is not available.

Account, Accreditation, AssessmentIndicatorDefinition, AssessmentTask, AssessmentTaskContentDocument, AssessmentTaskDefinition, AssessmentTaskOrder, Asset, AssetRelationship, AssignedResource, Award, BoardCertification, BusinessLicense, BusinessMilestone, BusinessProfile, Campaign, CareBarrier, CareBarrierDeterminant, CareBarrierType, CareDeterminant, CareDeterminantType, CareDiagnosis, CareInterventionType, CareMetricTarget, CareObservation, CareObservationComponent, CarePgmProvHealthcareProvider, CarePreauth, CarePreauthItem, CareProgram, CareProgramCampaign, CareProgramEligibilityRule, CareProgramEnrollee, CareProgramEnrolleeProduct, CareProgramEnrollmentCard, CareProgramGoal, CareProgramProduct, CareProgramProvider, CareProgramTeamMember, CareProviderAdverseAction, CareProviderFacilitySpecialty, CareProviderSearchableField, CareRegisteredDevice, CareRequest, CareRequestDrug, CareRequestExtension, CareRequestItem, CareSpecialty, CareSpecialtyTaxonomy, CareTaxonomy, Case, CommSubscriptionConsent, ContactEncounter, ContactEncounterParticipant, ContactRequest, Contract, CoverageBenefit, CoverageBenefitItem, CreditMemo, DelegatedAccount, DocumentChecklistItem, EnrollmentEligibilityCriteria, HealthcareFacility, HealthcareFacilityNetwork, HealthcarePayerNetwork, HealthcarePractitionerFacility, HealthcareProvider, HealthcareProviderNpi, HealthcareProviderSpecialty, HealthcareProviderTaxonomy, IdentityDocument, Image, IndividualApplication, Invoice, ListEmail, Location, MemberPlan, Opportunity, Order, OtherComponentTask, PartyConsent, PersonLifeEvent, PlanBenefit, PlanBenefitItem, ProcessException, Product2, ProductItem, ProductRequest, ProductRequestLineItem, ProductTransfer, PurchaserPlan, ReceivedDocument, ResourceAbsence, ReturnOrder, ReturnOrderLineItem, ServiceAppointment, ServiceResource, Shift, Shipment, ShipmentItem, Solution, Visit, VisitedParty, VolunteerProject, WorkOrder, WorkOrderLineItem

ActivityId :

ID of the activity that is associated with the email. Usually represents an open task that is created for the case owner when a new unread email message is received. ActivityId can only be specified for emails on cases. It’s auto-created for other entities.

You can't able to link a task to emailMessage

0

Only objects that have an Activity History can be a parent

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .