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

Is this possible with Ajax


My company is using Enterprise edition with the partner portal for affiliate sales people.  As I understand it, Apex is not an option with the version we are using, so I'm thinking maybe Ajax is an option.

Basically, we want a list of activities to be shown through a tab named Activities.  I have created a custom object and defined a tab for it.  This works great.  What I would like to do now, is on the save event for an activity, create a record in my custom object that can be listed in my custom tab.

I've seen that I can do this with triggers, however this isn't an option with my version.  Is there any other way of doing this?

The only reason I am doing this is because the activities tab isn't an option for partner portal.  Our sales people work off of followup phone calls and scheduling appointments.  Just having a list of leads is not too useful to them.
Yes, you can do this with an S-Control. I would recommend that you create an inline S-Control to copy the contents of the activity to the custom object. A quick example is:

<script src="/soap/ajax/10.0/connection.js"></script>
<script language="JavaScript">
{ if({!Not(Task.Is_Copied__c)})
  { Task = new sforce.SObject("Task")
    Task["Id"] = "{!Task.Id}"
    Task["Is_Copied__c"] = true
    CustomTask__c = new sforce.SObject("CustomTask__c")
    CustomTask__c["Date"] = new Date("{!Task.ActivityDate}")
    CustomTask__c["Subject"] = "{!Task.Subject}"
{ // Assuming permissions are okay, shouldn't get here.
  alert("There was an error processing this request:\n\n"+e)
I create the new record before updating so that I prevent the task from being marked as copied before it actually is.

Although a "safer" version would be one that required a user to click on the button so their browser doesn't freeze unexpectedly while it performs the operation or possibly cancels the script half-way through.

~ sfdcfox ~