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
Patryk StefaniakPatryk Stefaniak 

How to log lead activity

Hi everyone,

I'm trying to log a call as an activity in a lead. This is the record I'm passing to the saveLog Method:

task = {
    entityApiName: 'Task',
    CallDisposition: 'Success',
    CallType: direction,
    Subject: (isCallOutbound ? 'Call to ' : 'Call from ') + displayName,
    ActivityDate: date,
    CompletedDateTime: date,
    IsClosed: true,
    Type: 'Call',
    TaskSubtype: 'Call',
    Status: 'Completed'
};

if (recordType == 'Contact') {
    task.WhoId = popData.Id;
} else { // Account / Lead
    task.WhatId = popData.Id;
}

cti.saveLog({
    value: task,
    callback: ...
});
I tried changing the entityApiName to 'Activity', but that seemed wrong as I was getting the following error: "You don't have access to this record. Ask your administrator for help or to request access.".

I've also been getting an error related to the WhatId attribute: "Related To ID: id value of incorrect type: 00Q0900000OHl0UEAT".

Would apprieciate any help. Also a link to a detailed description of which fields can be passed to the saveLog method, if there is one.
Best Answer chosen by Patryk Stefaniak
DishantDishant (Salesforce Developers) 
Hi Patryk,

Please find the below help document.

https://help.formassembly.com/help/salesforce-error-id-value-of-incorrect-type#:~:text=What%20To%20Expect-,Introduction,Account%20ID%2C%20etc.).

Please mark this as a best answer if this was useful to you! 

Important Update

We appreciate your participation in these Salesforce Discussion Forums! It’s active members like you that keep our amazing community going strong.

At this time, we want to give you a heads up that on December 4, 2023, the discussion forums will shut down and all relevant discussions will migrate to the Trailblazer Community digital platform. This move brings all conversations around Salesforce development together in one place and provides more opportunities for our broader community to connect and share. We will be removing outdated, obsolete, or spam content and migrating only relevant discussions to the Trailblazer Community digital platform.

Starting November 20, you can view discussions but not post new questions or responses. On December 2, you will no longer be able to access the discussion forums from the Salesforce Developers website.

Please take these steps before November 30, 2023, 11:59 p.m. PT to ensure your contributions follow you to the Trailblazer Community:
  1. If you’re not already a member of the Trailblazer Community, sign up for a Trailblazer account using the same login email address associated with your Developer Discussion Forums account. This is crucial.
  2. If you already have a Trailblazer account, and it’s using a different email address from the one you used for your Developer Discussion Forums account, we recommend that you log in to the Trailblazer Community and connect your forums email address to your Trailblazer account.
Once you’re in the Trailblazer Community, join the Migration Support Hub users group to help you navigate this transition.

We will keep you up to date throughout the transition, and we look forward to seeing you joining the developer discussions in the Trailblazer Community!

Sincerely,
The Forums Support Team

 

All Answers

DishantDishant (Salesforce Developers) 
Hi Patryk,

Please find the below help document.

https://help.formassembly.com/help/salesforce-error-id-value-of-incorrect-type#:~:text=What%20To%20Expect-,Introduction,Account%20ID%2C%20etc.).

Please mark this as a best answer if this was useful to you! 

Important Update

We appreciate your participation in these Salesforce Discussion Forums! It’s active members like you that keep our amazing community going strong.

At this time, we want to give you a heads up that on December 4, 2023, the discussion forums will shut down and all relevant discussions will migrate to the Trailblazer Community digital platform. This move brings all conversations around Salesforce development together in one place and provides more opportunities for our broader community to connect and share. We will be removing outdated, obsolete, or spam content and migrating only relevant discussions to the Trailblazer Community digital platform.

Starting November 20, you can view discussions but not post new questions or responses. On December 2, you will no longer be able to access the discussion forums from the Salesforce Developers website.

Please take these steps before November 30, 2023, 11:59 p.m. PT to ensure your contributions follow you to the Trailblazer Community:
  1. If you’re not already a member of the Trailblazer Community, sign up for a Trailblazer account using the same login email address associated with your Developer Discussion Forums account. This is crucial.
  2. If you already have a Trailblazer account, and it’s using a different email address from the one you used for your Developer Discussion Forums account, we recommend that you log in to the Trailblazer Community and connect your forums email address to your Trailblazer account.
Once you’re in the Trailblazer Community, join the Migration Support Hub users group to help you navigate this transition.

We will keep you up to date throughout the transition, and we look forward to seeing you joining the developer discussions in the Trailblazer Community!

Sincerely,
The Forums Support Team

 
This was selected as the best answer
Patryk StefaniakPatryk Stefaniak
Thank you for the help Dishant

Additionally I found the object reference documentation which I was not aware of which was very helpful.
In case someone else stumbles upon a similar issue. Link (https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_task.htm)
DishantDishant (Salesforce Developers) 
Thank you for the additional help Patryk. Will make a note of it!