• Shirley Maglio
  • NEWBIE
  • 30 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 14
    Questions
  • 11
    Replies
During a merge, the losing Contact record's TaskRelations (TR) and EventRelations (TR) are not being transfered to the winning Contact record, if the losing Contact record is not the Primary Contact on the Task and Event.

I tried to make the above transfer happen with the following:
1. Retrieve TR and ER with relationId = losing Contact ID
2. Clone the TR and ER retrieved from step 1 and update the clone copy's relationId to point to the winning Contact ID
3. Delete the retrieved TR and ER from step 1.
4. Insert the cloned copy of TR and ER from step 2.

Code snippet for the above four steps:
private static void updateEventRelation(String WinId, String LosingId) 
        {        
            //Check if there are any EventRelations or not - If present then change that to Wininng Party
            List <EventRelation> lstEventRelationForDeletion = new List <EventRelation>();
            List <EventRelation> lstEventRelation = new List <EventRelation>();


            
            //Check if there are any EventRelations or not - If present then change that to Wininng Party
            for(EventRelation objEventRelation : [Select EventId, RelationId FROM EventRelation where RelationId=:LosingId]){
                    lstEventRelationForDeletion.add(objEventRelation);
                    EventRelation e = new EventRelation();
                    e = objEventRelation.clone(false, true, false, false);
                    e.eventid = objEventRelation.eventid;
                    e.relationid = WinId;
                    lstEventRelation.add(e);
                }
       
 
            if(lstEventRelationForDeletion.size() > 0 && lstEventRelationForDeletion <> null){                        
                delete lstEventRelationForDeletion;                 
            }
            
            if(lstEventRelation.size() > 0 && lstEventRelation <> null){
                insert lstEventRelation; 
                system.debug('@@@@@@ inserted ');
            }
        }

When I ran the merge with the above four steps, the TaskRelation got transfered over to the winning Contact record, but the EventRelation did not.
The debug logs shows that the above four steps for EventRelation were executed. I have confirmed via SOQL query that there is a new EventRelation with relationId pointing to the winning Contact record, but this new ER is not showing up on the winning Contact record's activity related list on the screen.

What wold be the possible reasons why the ER is not showing up on the winning Contact record's activity related list, when it works nicely for TR. Any help is appreciated.
Hi all,

I have a batch process that updates the WhoId field of Task records.  When this batch process executes, I am currently getting the following error:
 
Update failed. First exception on row 0 with id 00T0n000003j9xABCW; first error: INVALID_CROSS_REFERENCE_KEY, Updating the whoId fields for shared activities is not allowed.: [WhoId]

Share Activites are already enabled in my Salesforce org.  The below is the code snippet:
global class BatchMerge implements Database.Batchable<clsMerge>, Database.Stateful, Database.AllowsCallouts{

	global class clsMerge {
            Id WinId, LosingId;
            String WinSFDCPartyId, LosingSFDCPartyId;
            
            public clsMerge(String strWinID, String strLosingId){
                this.WinID = strWinID;
                this.LosingId = strLosingId;
            }
    }
    
    global void execute(Database.BatchableContext context, List<object> scope){

        for(object objectScope : scope) {
            clsMerge objectMerge = (clsMerge)objectScope;                
			String WinSFDCPartyId = objectMerge.WinId;
            String LosingSFDCPartyId = objectMerge.LosingId;
            list<Task> lstTask = new list<Task>();

            for(Task objTask : [Select Id, WhoId From Task where WhoID=:LosingSFDCPartyId]){
                objTask.WhoID = WinSFDCPartyId;
                lstTask.add(objTask);
            }

            if(lstTask.size() > 0 && lstTask <> null)
                update lstTask;
		}
	}
}

How can I resolve the above error?  Any help is greatly appreciated!

Shirley

 
Hi All,

I have inserted a Vf page as a section into the Account detail page.  I have a link on that Vf page, but when I clicked the link, the new page is only showing within the section containing the Vf page.

What do I have to do so the new page replaces the entire Account detail page within the browser window?

This is the link:
 
<apex:panelBar width="100%">
<apex:panelBarItem label="Links">
<a href="/00U/e?what_id={!Account.id}&retURL=%2F{!Account.id}" class="menuSelection mySelectedItem"><img src="/pic.gif" alt="Invitations"  class="menuIcons" title="Invitations"/></a>
</apex:panelBarItem>
</apex:panelBar>

Any help is greatly appreciated!

Shirley
Hi All,

I have overriden the standard "View" of the Account detail page with a custom Visualfroce page.  When I need to display the Account detail page, I use the "nooverride=1" parameter to display it and bypass the override.

I have also overridden Salesforce’s standard Delete button in a Related List of the Account detail page, by creating a second Visualforce page with an Apex controller extension class.

The problem I am having is, when I clicked the overridden Delete button in the Related List, the second Visualforce page is never called.  The standard Salesforce Delete was called instead.  I think this is happening because the Account Detail page was displayed with the nooverride=1" parameter.  Thus, no overrides were allowed.

Can someone give me some pointers as to how to call the overridden Delete button in the Related List, so that it will get called instead of the standard Salesforce Delete on the Account detail page (displayed with the nooverride=1" parameter)?

Any help would be greatly appreciated!

Shirley
Hi All,

I have overridden Salesforce’s standard Delete button in a Related List of an Account detail page. 

In order to override the standard Delete button, I have created a new Visualforce page with an Apex controller extension class.

How do I display the original Account detail page after I am done deleting?

Any help will be greatly appreciated!

Shirley
Hi All,

I am trying to override a standard button in Salesforce to call an external web service.  Can anyone give me some pointers on how to do this?

Thanks,
Nancy
 
Hi,

My visualforce page is generating the following error in IE8:

Message: Access is denied.Line: 67
Char: 338
Code: 0
URI: https://c.na17.visual.force.com/faces/a4j/g/3_3_3.Finalorg.ajax4jsf.javascript.AjaxScript?rel=1405565697000

Can anyone give me some pointers as to how to resolve this error?  Any help is greatly appreciated!

Thanks,
Shirley
Hi all,

Is it possible to package a custom Quote template into an AppExchange packaged application?  If yes, how can it be done?

Any help is greatly appreciated!

-Shirley
Hi,

I have embedded a Visualforce page as a section on the Quote Detail page.  How do I refresh the entire Quote Detail page, when a button is clicked on the Visualforce page?

Any help is greatly appreciated!

Thanks,
Shirley
Hi,

How to update the field values of a Quote object with field values from a selected row (checkbox) of a table on Visualforce?

Shirley
Hi,

I would like to know how to add a checkbox next to each row of a table in Visualforce?

Here is my Visualforce page:
<apex:page standardController="ProductEntity__c" recordSetVar=" listOfProductNotes " extensions="QRecords" >
     <apex:form >
     <apex:pageBlock title="Product Notes">
         <apex:pageBlockTable value="{!listOfProductNotes}" var="s">
               <apex:column value="{!s.ProductNotes__r.Name}"/>
         </apex:pageBlockTable>
     </apex:pageBlock>
     </apex:form>
</apex:page>
Any help is greatly appreciated!

Thanks,
Shirley Maglio
Hi,

Is there a way to add Visualforce as a section on the standard Quote Edit page?

Or must I override the entire standard Quote Edit page with a new Visualforce page?

~Shirley
Hi,

Can anyone advise on how to do this via Apex and Visualforce?  Or other ways and means? 

Any help is greatly appreciated!

Thanks,
Shirley Maglio
Hi,

I am trying to add a product description field and a price field to a custom object.  This custom object contains a lookup field to a Product object.  I understand the product description field is a standard field of the Product object.  Thus, I created a formula field on the custom object to get the product description from the Product object.

However, the price field is not a standard field of the Product object.  So I could not get the price of the product by via a formula field.  Can anyone give me some pointers as to how to get the price of the product?  This is so I can save it as a field on my custom object.

Any help is greatly appreciated!

Thanks,
Shirley
Hi all,

I have a batch process that updates the WhoId field of Task records.  When this batch process executes, I am currently getting the following error:
 
Update failed. First exception on row 0 with id 00T0n000003j9xABCW; first error: INVALID_CROSS_REFERENCE_KEY, Updating the whoId fields for shared activities is not allowed.: [WhoId]

Share Activites are already enabled in my Salesforce org.  The below is the code snippet:
global class BatchMerge implements Database.Batchable<clsMerge>, Database.Stateful, Database.AllowsCallouts{

	global class clsMerge {
            Id WinId, LosingId;
            String WinSFDCPartyId, LosingSFDCPartyId;
            
            public clsMerge(String strWinID, String strLosingId){
                this.WinID = strWinID;
                this.LosingId = strLosingId;
            }
    }
    
    global void execute(Database.BatchableContext context, List<object> scope){

        for(object objectScope : scope) {
            clsMerge objectMerge = (clsMerge)objectScope;                
			String WinSFDCPartyId = objectMerge.WinId;
            String LosingSFDCPartyId = objectMerge.LosingId;
            list<Task> lstTask = new list<Task>();

            for(Task objTask : [Select Id, WhoId From Task where WhoID=:LosingSFDCPartyId]){
                objTask.WhoID = WinSFDCPartyId;
                lstTask.add(objTask);
            }

            if(lstTask.size() > 0 && lstTask <> null)
                update lstTask;
		}
	}
}

How can I resolve the above error?  Any help is greatly appreciated!

Shirley

 
Hi All,

I have overriden the standard "View" of the Account detail page with a custom Visualfroce page.  When I need to display the Account detail page, I use the "nooverride=1" parameter to display it and bypass the override.

I have also overridden Salesforce’s standard Delete button in a Related List of the Account detail page, by creating a second Visualforce page with an Apex controller extension class.

The problem I am having is, when I clicked the overridden Delete button in the Related List, the second Visualforce page is never called.  The standard Salesforce Delete was called instead.  I think this is happening because the Account Detail page was displayed with the nooverride=1" parameter.  Thus, no overrides were allowed.

Can someone give me some pointers as to how to call the overridden Delete button in the Related List, so that it will get called instead of the standard Salesforce Delete on the Account detail page (displayed with the nooverride=1" parameter)?

Any help would be greatly appreciated!

Shirley
Hi All,

I have overridden Salesforce’s standard Delete button in a Related List of an Account detail page. 

In order to override the standard Delete button, I have created a new Visualforce page with an Apex controller extension class.

How do I display the original Account detail page after I am done deleting?

Any help will be greatly appreciated!

Shirley
Hi All,

I am trying to override a standard button in Salesforce to call an external web service.  Can anyone give me some pointers on how to do this?

Thanks,
Nancy
 
Hi,

My visualforce page is generating the following error in IE8:

Message: Access is denied.Line: 67
Char: 338
Code: 0
URI: https://c.na17.visual.force.com/faces/a4j/g/3_3_3.Finalorg.ajax4jsf.javascript.AjaxScript?rel=1405565697000

Can anyone give me some pointers as to how to resolve this error?  Any help is greatly appreciated!

Thanks,
Shirley
Hi,

I have embedded a Visualforce page as a section on the Quote Detail page.  How do I refresh the entire Quote Detail page, when a button is clicked on the Visualforce page?

Any help is greatly appreciated!

Thanks,
Shirley
Hi,

I would like to know how to add a checkbox next to each row of a table in Visualforce?

Here is my Visualforce page:
<apex:page standardController="ProductEntity__c" recordSetVar=" listOfProductNotes " extensions="QRecords" >
     <apex:form >
     <apex:pageBlock title="Product Notes">
         <apex:pageBlockTable value="{!listOfProductNotes}" var="s">
               <apex:column value="{!s.ProductNotes__r.Name}"/>
         </apex:pageBlockTable>
     </apex:pageBlock>
     </apex:form>
</apex:page>
Any help is greatly appreciated!

Thanks,
Shirley Maglio
Hi,

Can anyone advise on how to do this via Apex and Visualforce?  Or other ways and means? 

Any help is greatly appreciated!

Thanks,
Shirley Maglio
Hi,

I am trying to add a product description field and a price field to a custom object.  This custom object contains a lookup field to a Product object.  I understand the product description field is a standard field of the Product object.  Thus, I created a formula field on the custom object to get the product description from the Product object.

However, the price field is not a standard field of the Product object.  So I could not get the price of the product by via a formula field.  Can anyone give me some pointers as to how to get the price of the product?  This is so I can save it as a field on my custom object.

Any help is greatly appreciated!

Thanks,
Shirley