+ Start a Discussion
Rakshith RamachandraRakshith Ramachandra 

sObject Activities not present in Sandbox

I'm trying to move an Apex class from Sandbox to Production. I need to use records from "Activities" in a SOQL query. The problem is that my Sandbox doesn't have "Activities" sObject but production does. When I try to use "Activities" sObject in the sandbox it throws an error. I have to use the sObject "Activities" before moving it to Production coz I won't be able to add new/edit a Apex Class in Production.

Appreciate any help. Thanks
Best Answer chosen by Rakshith Ramachandra
Swayam@SalesforceGuySwayam@SalesforceGuy
Hi,

There is no sObject Activities, If you want to  Use Activities you can use Task and Event which comes under activity.

Activities/Activity is a single logical object type holding both Tasks & Events.. and Tasks and Events are the concrete physical object types that you can run your queries on..
Select Id,YourCustomField__c from Task
Select Id,YourCustomField__c from Event
Please let me know in case of any doubt.

Hope this helps.

--
Thanks,
Swayam


 

All Answers

Swayam@SalesforceGuySwayam@SalesforceGuy
Hi,

There is no sObject Activities, If you want to  Use Activities you can use Task and Event which comes under activity.

Activities/Activity is a single logical object type holding both Tasks & Events.. and Tasks and Events are the concrete physical object types that you can run your queries on..
Select Id,YourCustomField__c from Task
Select Id,YourCustomField__c from Event
Please let me know in case of any doubt.

Hope this helps.

--
Thanks,
Swayam


 
This was selected as the best answer
Rakshith RamachandraRakshith Ramachandra
User-added imageUser-added image

Hi Swayam@SalesforceGuy,

Thanks for the quick reply. I'm new to salesforce and maybe I've understood everything wrong but I want to access CallDisposition Field under Activities.

So should I be writing Select CallDisposition from Task instead of Select CallDisposition from Activities ?

Thanks,
Rakshith
Swayam@SalesforceGuySwayam@SalesforceGuy
Hi 

You are right, you have to use  Select CallDisposition from Task. CallDisposition is only avilable for Task not for event, 

Hope this helps.

--
Thanks,
Swayam
Rakshith RamachandraRakshith Ramachandra
Perfect. It works. 

If I try doing the same for "Owner" field i.e; Select Owner from Task it throws an error No such column 'Owner' on entity 'Task'. Any ideas on how to make it work?

Thanks
Rakshith
Swayam@SalesforceGuySwayam@SalesforceGuy
Hi,
You have to use ownerId and if you want to get the Name you have to use ownerId.Name,

Please refer all the avialable field of Task here https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_task.htm

--
Thanks
​Swayam
Rakshith RamachandraRakshith Ramachandra
Thanks a lot. That clears a lot of things. 

I'm trying to retrieve records using SOQL query inside apex class and return the retrieved records to visualForce. The idea is to download the records to an excel report using VF page. I used help from this site
https://help.salesforce.com/apex/HTViewSolution?id=000003176

Heres my code -

User-added image

My visulaForce code looks something like this (beta version) -
 
<apex:page controller="TestMe2" contentType="application/vnd.ms-excel#SalesForceExport.xls" cache="true">
    <apex:pageBlock title="Export Results" >
        <apex:pageBlockTable value="{!cs}" var="Task">
            <apex:column value="{!Task.OwnerId}"/>
            <apex:column value="{!Task.CallDisposition}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:page>

This is my first time using Apex and VF. Please let me know if I'm doing anything wrong. Thank a ton for all the help.

Thanks,
Rakshith
 
Swayam@SalesforceGuySwayam@SalesforceGuy
Hi,

Just Replace this line 
<apex:pageBlockTable value="{!cs}" var="Task">

By This

<apex:pageBlockTable value="{!records}" var="Task">

Hope this help, Also if you have any question please raise a seprate question in the forum.

--
Thanks,
Swayam

 
Rakshith RamachandraRakshith Ramachandra
Awesome. Thanks a lot for your help. Have a great day