0

Sorry if this is a duplicate article but I'm not even sure how to search this one. I am creating a third party app via cURL in PHP. I have a custom patient object and I can query OpenActivities as a relationship query on patient. I get the items back all fields are there, no problems. However when trying to create an object of this type I run into an issue. The records that come through in OpenActivities seems to be a hybrid(JOIN statement?) of Activity object and Tasks objects as I can see all fields mapped across both of these objects from my SF setup console. If I try to create a Task, it tells me the fields on the Activity object doesn't exist, which makes sense because they are two separate objects.

So I figured ok I will just have to create two separate objects and link them together some how. Tasks I can create, but I cant create anything for "Activity" or "OpenActivities" as it says those objects don't exist.

Can anyone explain this relationship to me and guide me in the right direction?

1 Answer 1

1

There's actually four relationships for activities: Tasks, Events, OpenActivites, and ActivityHistories. The two real objects are Tasks and Events. OpenActivities shows open tasks and events today or in the future. ActivityHistories shows closed tasks and events before today (in the past). When you want to show the history or future activity of a record, you use the two "hybrid" objects, but when you want to create a real task or event, you use the two real objects (and they'll automatically appear in the appropriate hybrid relationship).

5
  • Neither event nor task hold the custom fields I need though. When I go to Schema Builder I can see an activity object, an event object and a task object. According to the Schema builder the custom fields I want are on the Activity object, but "activity" does not seem to be a valid object, like you stated it's between tasks and events. But again if I go into the patient record in SF I can create a new task and it offers all the fields on task plus the custom fields on Activity. So how do I create a task from the API that then accommodates those fields if they are not on task or event? Apr 14, 2016 at 20:12
  • @JeffAlanMidler They're stored in activity, but they should also appear as task and event fields (because activity is a super-class of both). What WSDL are you using?
    – sfdcfox
    Apr 14, 2016 at 20:32
  • The package is Enterprise, I am interacting with SF via the SOAP API. Apr 14, 2016 at 21:19
  • Actually I'm not 100% sure I am using the SOAP API. I am making calls to SalesForce API URI's via cURL. I generated a WSDL for the php toolkit back when I was using that, but the php toolkit required a username and password be given to it. The organization I am developing for did not want separate logins so I moved away from it as I could not figure out how to use the php toolkit without capturing another login. Using cURL I can just piggy back off an existing SF login or route to SF for login and then it routes back to my app. Being that I am using cURL though I am not currently using a WSDL. Apr 14, 2016 at 22:57
  • I am using this guide, so I guess I am using the Rest API not SOAP, I apologize for that error I just assumed it was the SOAP API developer.force.com/cookbook/recipe/… Apr 14, 2016 at 22:59

You must log in to answer this question.

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