• @CA
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
We have enabled shared activity feature so that we can add multiple contact to name field of an event.. It works from the UI..
But when we try to update WhoID field form the class it replaces the existing contact.. need some help in adding multiple events to the contact thru apex.
sample Method:

public void updateEvents(){

        for(Event Evt:[Select Id, WhoId from Event where Id =:selectedRecID]){
        Evt.WhoId=Id;
        updateEventList.add(Evt);
        }
        if(!updateEventList.isEmpty()){
        update updateEventList;
        }
       
    }

Any help on this will be apprecited.
  • July 30, 2016
  • Like
  • 0
On my Opportunity object: I have created six custom fields
AVSFQB__Generate_Object__c  (picklist)
AVSFQB__Quickbooks_Id__c  (text 50 - External ID)
AVSFQB__QuickBooks_ItemType__c   (picklist)
Sample_Generate__c  (text 100)
Sample_Quickbooks_ID__c   (text 50)
Sample_QuickBooks_ItemType__c   (text 100)
I have also created a custom button Process_Sample_Sent

I would like to click the button and move the field contents:
AVSFQB__Generate_Object__c to Sample_Generate__c
AVSFQB__Quickbooks_Id__c to Sample_Quickbooks_ID__c
AVSFQB__QuickBooks_ItemType__c to Sample_QuickBooks_ItemType__c

On the custom button, I have selected:
Display type - Detail Page Button
Behavior - Execute JavaScript
Content Source - OnClick JavaScript

I am trying to get this code to work with one set of fields before I add the others

This code produces an "Unexpected identifier error"
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")} 
var record = new sforce.SObject("Opportunity__c"); 
record.Id = ("Opportunity__c.Id"); 
record.Sample_Generate__c = {!Opportunity.AVSFQB__Generate_Object__c};
var result = sforce.connection.update([record]); 
// check the result here 
window.location.reload();