• GauravKumar
  • NEWBIE
  • 65 Points
  • Member since 2008

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 18
    Questions
  • 27
    Replies

 

		Campaign[] c = [Select ID From Campaign Where Name = 'Customer Communication'];
		if (c.size() > 0) {
			CampaignMember[] toAdd 	= 	new CampaignMember[] {};
			CampaignMember[] toDel 	= 	[Select ID From CampaignMember Where CampaignId =: c[0].Id];
			
			for (Contact co : [Select ID From Contact
							   Where  AccountId IN (Select Account__c From Subscription_Contracts__c Where Status__c = 'Current')
							   And Email != null])
			{
				CampaignMember cm 	= 	new CampaignMember();
				cm.CampaignId 		= 	c[0].Id;
				cm.ContactId 		= 	co.Id;
				
				toAdd.add(cm);
				system.debug('\n@@toAdd : '+cm);
			}
			if ( !toDel.isEmpty() )
				delete toDel;
			if ( !toAdd.isEmpty() )
				insert toAdd;
		}

 

Above is my code to Clean the Campaign and then Add the CampaignMembers to it again. but it is causing following Exception on "insert toAdd" line:

 


System.DmlException: Insert failed. First exception on row 100; first error: DUPLICATE_VALUE, This entity is already a member of this campaign: [] clsUpdateMarketingCampaigns.cls
I don't see how can there be a duplicate entity, can anyone please help me point out erroreneous code which I might be doing wrong here? plz.

 

 

is there cany way we can move Case Email Attachments to Case instaead of the Email via any Trigger?

 

I know when a Case Email is sent, it gets logged into EmailMessage, but my trigger on EmailMessage returns no Attachments, and my trigger on Attachment object does not fire at all, as if when Email attchments are inserted into Attachment it never triggers the attachment trigger.

 

Can anyone help me ... plz.

Can anybody help me how can i do this

When an email  record is created and linked to a Case, then attachment files linked to the email record moved to be part of the Attachments related list for the Case, not the Email.

 

My trigger code is

 

 

trigger emailAttachment on EmailMessage (after insert) {
 
 Attachment[] atts = new Attachment[] {};
 for (Attachment a : [Select ID, ParentID From Attachment Where ParentID IN: trigger.new])
 {
  a.ParentId = trigger.newMap.get(a.ParentID).ParentID;
  atts.add(a);
 }
 if (!atts.isEmpty())
  update atts;
 
}

 

 

this is giviming me no rows.

how can i do this? can anybody help me plz ?

Thanks in Advance

Hi,

Can anybody help how can i create trigger on Feed Comment Entry ?

Basically i am trying to update Case Record soem field on Catter Comment entry.

can any body tell me how can i do this ?

 

Thanks in Advance

Hi,

I am creating PartnerNetworkRecordConnection records for selected opportunity.

My Code is

 

 

           List<PartnerNetworkRecordConnection> list_connRec = new List<PartnerNetworkRecordConnection>();
            for (Opportunity o : (List<Opportunity>) con.getSelected()) {
                PartnerNetworkRecordConnection newrecord = new PartnerNetworkRecordConnection();
                newrecord.ConnectionId = ConnectionId;
                newrecord.LocalRecordId = opportunity.Id;
                newrecord.SendClosedTasks = true;
                newrecord.SendOpenTasks = true;
                newrecord.SendEmails = false;
                list_connRec.add(newrecord);
            }
            if(list_connRec.size()>0)
                insert list_connRec;

 

 

 

at the time of save i got this error and  Error message is

 

__MISSING LABEL__ PropertyFile - val InvalidStatusForPartnerNetworkOperationException not found in section Exception

 

can anybody help me, how can i resolve this error

 

Thanks

 

 

Hi All,

 

I Have fetech Opportunity Record with Task in Sub query. My Query is Like This 

 

Select Id, Name,

(Select Id, ActivityDate From Tasks)

From Opportunity Where IsClosed=False And BCD_Firm__c = true  And Regional_Manager__c = 'XYZ' Order By Regional_Manager__c 


This Query is Returning Opportunity List and it is showing only only Last 1 -2 Years Task not all Task List.

 

I have also fetched Separately Task by Using this Query but this This returns No Tasks for the Selected Opportunity

Select Id, ActivityDate From Task Where WhatId = 'ABC'

 

Here 'ABC' is Opportunity ID

 

 

Even Though Tasks Related List in organization show activities. I could not find proper explanation for this behaviour but i think SOQL query is auto filtering activities which are very old like tasks which are 4-5 years old. 

 

Can anybody Help me to figure out This Problem ? 

 

I have Event New link overrided to custom Visualforce Page. Now In Single User view of Calendar when I Click Plus icon (+ sign) next to Date, it redirects to new Event page and date is populated for the Date I clicked.

 

But in Multiuser View of calendar this New Event  link for + icon is not opening page with date pre-selected.

 

I have noticed that on New event from Calendar in single user view we have "evt4", "evt13" and "RecurrenceStartDateTime" querystring variables populated with date nad time values. But on multiple user View no Querystring URL is sent.

 

Can anyone help me how should I fix this?

Hi,

 

 I have created Mass Update Button Name "Close".

I want to Mass Update Task Status on "Close" Button Click.

how can i do this ?

 

and when i have fetch task List then it gives error 

 

"List controllers are not supported for Task" .

 

Then how can i fetch task list for Mas Update of Task Record.

 

can anybody help me plz ?

 

 

Hi,

 

I have create my Send Email Page, on this page i have used select template dropdown and when i select Template then Subject and Body fill automatically in My Email Form Subject and Body Field on the behalf of Selected Template. But when i put any chages in Body Like...

I use "Hello" word in My Selected Template but  I want to change this word from "Dear" in my Email Body. Then It gives Error :

 

 

INVALID_FIELD_WHEN_USING_TEMPLATE, When a template is specified the plain text body, html body and subject may not be specifie

 

 I have used this at this time of Email Send in My Code

 

 

mail.setTemplateId(selectedtemplate); mail.setHTMLBody(Body); mail.setPlainTextBody(Body);

 I want that if i made any changes in my Email Body after selection of Template then those changes are being transfer with Email.

This is possible ?

If Yes then anybody help me ?

 

 

 

How can I read information regarding What packages are installed in a Org? 

 

I want to read information regarding Installed packages using a visualforce Page and APEX class. Also, how can I read Tabs related to a packages installed in the Org. 

Any idea?

I am finding it very irritating in a situation where I implement a Mass Update Button on a List View tab and I've Set the Button as Visualforce Page redirect then I CANNOT display a Message alert for User to First Select records, the way sControls work, I'm stuck here without any check for that button. And I cannot use scontrols for implementing the button.

 

Any suggestion or any info when will salesforce allow us to apply a Record Selection validation alert when we implement a List Button with Visualforce page redirect ?

Hi

 

I am trying to insert a Visualforce page in standard layout of my custom object.

 

I was successful in inserting it in layout editor. But it is displaying Only in Detail Form of the record. I need to display it in Edit Part of the record too.

 

How can I do that? Any help would be appreciated. Thanks.

Hi

I have used Custom Object and I have Del link in it's Detail List View




and I have Provide each type of security sharing and provide full privileges to Low user



When I click on Del then it gives error




So can anyone help to solve this Problem :(
Hi.

I have used Custom Object and I have Del link in it's Detail List View




and I have Provide each type of security sharing and provide full privileges to Low user





but when i click on del link then record does not delete and give this error


So can anyone help to solve this Problem :(



Message Edited by GauravKumar on 01-20-2009 04:40 AM
Hi,
I have an problem. I have used EnhancedList Component of Salesforce but it does not work with USER object


Code:
<apex:page standardController="User" tabstyle="User">
<apex:enhancedList type="User" height="750" rowsPerPage="25" id="UserList"></apex:enhancedList>
</apex:page>

Can anyone Help me to find out my problem solution ?


Hi
I have Create Custom Object Matter and it's name field is Matter Name.
In matter Layout i have used this field once and when i saw preview if this page then it appears correct.
I have create MatterDetails Page but when i saw it in details section on Matter Details then it appears twice.
Can anyone help me ?
Hi ,
I have made an Standard Controller page. In this Standard controller page i have used like this
Code:
<apex:page standardController="Contact" tabStyle="Contact" recordSetVar="allContacts" extensions="ContactMassUpdate" showHeader="true"> 

 
but this give error
Error is :
Code:
Save error: Unknown constructor 'ContactMassUpdate.ContactMassUpdate(ApexPages.StandardSetController controller)'

 
I think This error comes due to use recordSetVar and extensions together is there is any alternate solution of this or i am wrong at an any step
How can I do this. Can you plz help me


Hi,
I have an Prpblem Related to Customize List Button.
I want to add multiple oprtion in One Button(For Mass Update)
Like
Chnage Owner
Change Role
Change Type
Change Status
I want to put all those option in one List button for Mass Update.
How can I do this.Can you plz help me ...


 

		Campaign[] c = [Select ID From Campaign Where Name = 'Customer Communication'];
		if (c.size() > 0) {
			CampaignMember[] toAdd 	= 	new CampaignMember[] {};
			CampaignMember[] toDel 	= 	[Select ID From CampaignMember Where CampaignId =: c[0].Id];
			
			for (Contact co : [Select ID From Contact
							   Where  AccountId IN (Select Account__c From Subscription_Contracts__c Where Status__c = 'Current')
							   And Email != null])
			{
				CampaignMember cm 	= 	new CampaignMember();
				cm.CampaignId 		= 	c[0].Id;
				cm.ContactId 		= 	co.Id;
				
				toAdd.add(cm);
				system.debug('\n@@toAdd : '+cm);
			}
			if ( !toDel.isEmpty() )
				delete toDel;
			if ( !toAdd.isEmpty() )
				insert toAdd;
		}

 

Above is my code to Clean the Campaign and then Add the CampaignMembers to it again. but it is causing following Exception on "insert toAdd" line:

 


System.DmlException: Insert failed. First exception on row 100; first error: DUPLICATE_VALUE, This entity is already a member of this campaign: [] clsUpdateMarketingCampaigns.cls
I don't see how can there be a duplicate entity, can anyone please help me point out erroreneous code which I might be doing wrong here? plz.

 

 

is there cany way we can move Case Email Attachments to Case instaead of the Email via any Trigger?

 

I know when a Case Email is sent, it gets logged into EmailMessage, but my trigger on EmailMessage returns no Attachments, and my trigger on Attachment object does not fire at all, as if when Email attchments are inserted into Attachment it never triggers the attachment trigger.

 

Can anyone help me ... plz.

Can anybody help me how can i do this

When an email  record is created and linked to a Case, then attachment files linked to the email record moved to be part of the Attachments related list for the Case, not the Email.

 

My trigger code is

 

 

trigger emailAttachment on EmailMessage (after insert) {
 
 Attachment[] atts = new Attachment[] {};
 for (Attachment a : [Select ID, ParentID From Attachment Where ParentID IN: trigger.new])
 {
  a.ParentId = trigger.newMap.get(a.ParentID).ParentID;
  atts.add(a);
 }
 if (!atts.isEmpty())
  update atts;
 
}

 

 

this is giviming me no rows.

how can i do this? can anybody help me plz ?

Thanks in Advance

Hi All,

 

I Have fetech Opportunity Record with Task in Sub query. My Query is Like This 

 

Select Id, Name,

(Select Id, ActivityDate From Tasks)

From Opportunity Where IsClosed=False And BCD_Firm__c = true  And Regional_Manager__c = 'XYZ' Order By Regional_Manager__c 


This Query is Returning Opportunity List and it is showing only only Last 1 -2 Years Task not all Task List.

 

I have also fetched Separately Task by Using this Query but this This returns No Tasks for the Selected Opportunity

Select Id, ActivityDate From Task Where WhatId = 'ABC'

 

Here 'ABC' is Opportunity ID

 

 

Even Though Tasks Related List in organization show activities. I could not find proper explanation for this behaviour but i think SOQL query is auto filtering activities which are very old like tasks which are 4-5 years old. 

 

Can anybody Help me to figure out This Problem ? 

 

Hi All,

 

 

In our requirement we are emailing attachments using apex.  

 

I found that email attachment size is limited to 3mb, from the following link,

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_attachment.htm

. Kindly confirm this.

 

 

Are anyone of you able to send attachment more than 3 mb size? If so please post your suggestions.

 

Thanks in advance

 

 

Cheers,

Vishnu 

  

I have Event New link overrided to custom Visualforce Page. Now In Single User view of Calendar when I Click Plus icon (+ sign) next to Date, it redirects to new Event page and date is populated for the Date I clicked.

 

But in Multiuser View of calendar this New Event  link for + icon is not opening page with date pre-selected.

 

I have noticed that on New event from Calendar in single user view we have "evt4", "evt13" and "RecurrenceStartDateTime" querystring variables populated with date nad time values. But on multiple user View no Querystring URL is sent.

 

Can anyone help me how should I fix this?

Hi,

 

 I have created Mass Update Button Name "Close".

I want to Mass Update Task Status on "Close" Button Click.

how can i do this ?

 

and when i have fetch task List then it gives error 

 

"List controllers are not supported for Task" .

 

Then how can i fetch task list for Mas Update of Task Record.

 

can anybody help me plz ?

 

 

How can I read information regarding What packages are installed in a Org? 

 

I want to read information regarding Installed packages using a visualforce Page and APEX class. Also, how can I read Tabs related to a packages installed in the Org. 

Any idea?

I am finding it very irritating in a situation where I implement a Mass Update Button on a List View tab and I've Set the Button as Visualforce Page redirect then I CANNOT display a Message alert for User to First Select records, the way sControls work, I'm stuck here without any check for that button. And I cannot use scontrols for implementing the button.

 

Any suggestion or any info when will salesforce allow us to apply a Record Selection validation alert when we implement a List Button with Visualforce page redirect ?

Hi

 

When using describeLayout to get back ALL layouts, it appears that you get back the ID of each layout:

 

An individual DescribeLayout consists of the following fields:

NameTypeDescription
buttonSection DescribeButtonSection[]Standard and custom button(s) associated with the specified layout.
detailLayoutSections DescribeLayoutSection[]Layout section(s) for the detail view.
editLayoutSections DescribeLayoutSection[]Layout section(s) for the edit view.
id ID Unique ID of this Layout. For information on IDs, see ID Field Type.
relatedLists RelatedList[]Related list(s) associated with the specified layout.

 

My question is, how do you get the Name of the page layout?

 

Thx,

Hamayoun

Hi.

I have used Custom Object and I have Del link in it's Detail List View




and I have Provide each type of security sharing and provide full privileges to Low user





but when i click on del link then record does not delete and give this error


So can anyone help to solve this Problem :(



Message Edited by GauravKumar on 01-20-2009 04:40 AM
How i can get the layouts metadata from the apex controller ?

The metadata API has a method describeLayout() or getDescribeLayout() but i cannot make it works at the controller.

If that is not possible , how i can connect to the metadata api from the apex controller?

Thanks
Br1
  • October 15, 2008
  • Like
  • 0
Hello everyone, just wanted to share with the community this custom component I made and give something back for the help I've received. :smileyhappy:

The purpose of the component is to enable autocomplete in lookup fields. I used the autocomplete js created by Jim Roos:
(http://www.jimroos.com/2007/05/ajax-autocomplete.html) but made some modifications to it so that it could interact with an Apex controller among some other things...

So my idea was that if you were making a VF page that had an inputfield that was related to a lookupfield you would just insert this autocomplete component to that inputfield. Something like this:

Code:
           <apex:inputField value="{!Contact.accountid}" id="accname" styleClass="cField">
<c:autocomplete ObjectName="Accounts" InputId="{!$Component.accname}" AutoCompleteId="accACid" ClassName="autocomplete300"/>
</apex:inputField>

The component has 4 parameters:

The name of the object or custom object that the inputfield relates to (new objects must be added inside the apex classes since i had some problems constructing a dynamic query).
The InputId which is used to relate the component to the input field
The id for the Component
A classname parameter that basically just defines the width of the suggestions menu.

Here's a screenshot of how it looks like in action:




Here's a link to the file containing the required files:

AutoCompleteComponent



Jonathan.


Message Edited by jonathan rico on 08-16-2008 01:55 PM

Message Edited by jonathan rico on 08-17-2008 09:04 AM
Message Edited by jonathan rico on 01-02-2010 05:01 PM
Hi,

I have enabled inline editing feature in my SFDC instance which works fine for all the objects. I tried overriding New/Edit button on Opportunity  which calls an  S-Control and takes back to the Opportuinty Layout after  processing. Once the S-Control moves back to the Opportunity, Inline Editing feature gets disabled for that opportunity and it doesnt works.

Should we pass on some hidden parameter to the opportunity page while transfering control to the opportunity which keeps that inline editing feture enabled?

Please suggest..

Thanks in advance.


Message Edited by GreatG on 12-20-2007 03:03 AM
  • December 20, 2007
  • Like
  • 0