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
sawaji varunsawaji varun 

How to insert custom activities to accounts

I have ceated to fields Mobile Number and SMS Description using VF Page. I'm able to create the task, When I click the button submit, these to field details added to activities in account. How to do it.Please anybody help me on this.
salesforce mesalesforce me
hi check this...

yes - go to setup - click on customize, activities, activity custom fields - enter the field that you need
- remember activity fields can appear on events and tasks so be sure and think thru your change
sawaji varunsawaji varun
This One I am doing though visual force page and Cusom button as SUBMIT.How to do it.
Hi Sawaji,

Can you please share your code here, so that we can understand you correctly.

sawaji varunsawaji varun
The Code has given below. I have created the custom button(send sms) on activities in account.When clicked on send SMS, the VF page opens in that Mobile Number and SMS description and One button displayed. When clicked button on VF page the Mobile number and SMS desprion will added to the activities in the accounts.

VF Page

<apex:page standardController="Task" extensions="CBD_SendSMS" sidebar="false" >
<apex:form >
  <apex:pageBlock > 
<apex:pageBlockSection columns="2">
 <apex:inputfield value="{!tsk.Mobile_Number__c}"/>
 <apex:inputTextarea value="{!tsk.SMS_Description__c}"/>
 <!--<apex:inputField value="{!tsk.Lead_Lookup__c}"/>
  <apex:inputField value="{!tsk.Account_Lookup__c}"/>
   <apex:inputField value="{!tsk.Opportunity_Lookup__c}"/>-->
 <apex:commandButton value="Send SMS" action="{!sendSMS}" style="margin-left:600px;width=50px;height=30px"/>

Apex Class

public with sharing class CBD_SendSMS {
 public Task tsk{
    get {
      if (tsk == null)
        tsk = new Task();
      return tsk;

public PageReference sendSMS() {
         // Integer fPhone=tsk.Mobile_Number__c;
        //  if (fphone.length() != 10) {
         // tsk.addError('Error1');
       //   }
         Id id1= System.currentPageReference().getParameters().get('Id'); 
        tsk.WhatId = id1;
       tsk.RecordtypeId = '012p00000004O5k';
         insert tsk;
        pageReference pageref= new pageReference('/' + tsk.Id);
        Task tsk = new Task();
        return pageref;
  public CBD_SendSMS(ApexPages.StandardController controller) 
  this.tsk = (Task)Controller.getRecord();