Search code examples
salesforcesalesforce-rest-api

Is it possible to create a custom Salesforce activity type via the REST API?


In Salesforce, I would like to add a custom activity to a contact's or opportunity's Activity timeline. For example, in the timeline below, we see an outgoing email, and two tasks:

enter image description here

As far as I can discover so far, this activities list is made of of Events and Tasks, with an "event" essentially a meeting or similar, which appears on the calendar, and a "task" being a type of to-do item.

I would like to add something completely custom, with its own fields/text, and preferably with its own icon. Is it possible to do this via the REST API?


Solution

  • No, this component works only off Activities (which are kind of readonly "view" of Tasks + Events because they share many fields). You can insert new tasks via API but can't make other records show here.

    What you could do is create custom component with UI looking similar to this and plug your own data. Salesforce described all the html tags, CSS class names etc needed to achieve something close enough: https://www.lightningdesignsystem.com/components/activity-timeline/

    You'd still need to write all JavaScript onclick handlers etc... Luckily looks like somebody did the heavy lifting: https://github.com/anandbn/timeline-lwc (there may be better clones of it, more actively maintained. Check https://github.com/anandbn/timeline-lwc/forks out)

    Try to install this in your sandbox, configure it, hook up your custom object and swap the original on the lightning pages?