• samba
  • NEWBIE
  • 140 Points
  • Member since 2010

  • Chatter
    Feed
  • 5
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 107
    Replies

Hi -

I'm trying to retrieve Account phone number, Account Number from Contact. But I'm not able to.. Plzz help.

 

 

 List<Contact> conts = [SELECT ID, NAME, Account.Phone, Account.AccountNumber FROM CONTACT WHERE AccountId != NULL LIMIT 2];
   System.debug('$$$$$ CONTACTS ARE @@@@@@@' + conts[0]);

  • July 22, 2013
  • Like
  • 0

I'm sure I'm missing something here, so hopefully someone can help. I have a custom object that is used as a questionnaire and I'm developing a VF page because the length of each question is too long for a standard object label. Here's the VF page:

<apex:page standardController="Question__c" >
<apex:form id="theForm"> 
	<apex:outputPanel style="font-weight:bold;font-size:18pt;align:center;background-color:#CCFFCC;width=70%;">
					Opportunity Questionnaire:
	</apex:outputPanel>
	<apex:pageBlock >
		<apex:pageBlockButtons > 
			<apex:commandButton value="Save" action="{!save}"/>        
			<apex:commandButton value="Cancel" action="{!cancel}" immediate="true"/>
		</apex:pageBlockButtons>
		<apex:outputPanel style="font-size:12pt;align:center;background-color:#99FF99;"><span style="font-size:16pt">
						METRICS
		</apex:outputPanel> 	
		<apex:pageBlock >
			<apex:outputPanel style="font-size:12pt;align:center;background-color:#99FF99;;">
						1. WHAT METRICS/SUCCESS STORIES DO WE HAVE TO SUPPORT THIS SALES CAMPAIGN? 
			</apex:outputPanel>
			<apex:pageBlockSection columns="1">
				<apex:pageBlockSectionItem >
					<apex:inputField value="{!Question__c.Q1__c}" style="width:70%;"/>   
				</apex:pageBlockSectionItem>                                    
			<apex:pageBlockSection>              
		</apex:pageBlock>
	</apex:pageBlock> 
</apex:form>
</apex:page>
                

 

The question object is on a related list of the opportunity and I embedded this page into the page layout for the Question object. When I create a new Question, it looks great. But when I save it, it still looks like it's in Edit mode. I assume this is because I only have "inputField" statements, but how can I set this up so that it has "inputField" statements during edit and "outputField" styatements during display?  Any clues on what I am doing wrong? 

Is it possible to autoupdate or autopopulate a picklist? I have a picklist with users name. If a user changes his name, the new user name should be displayed in the picklist and the old name should be gone.

Thanks

Hi,

I was going through the Apex developers guide, but did not find what does this mean?

 value="{0,number,currency}"> 

-------------------------------------------------------------------------------------------

<apex:page standardController="Account" renderAs="pdf">
<h1>Account Details</h1>
<apex:panelGrid columns="2">
<apex:outputLabel for="Name" value="Name"/>
<apex:outputText id="Name" value="{!account.Name}"/>
<apex:outputLabel for="Owner" value="Account Owner"/>
<apex:outputText id="Owner" value="{!account.Owner.Name}"/>
<apex:outputLabel for="AnnualRevenue" value="Annual Revenue"/>

 <apex:outputText id="AnnualRevenue" value="{0,number,currency}"> 

<apex:param value="{!account.AnnualRevenue}"/>
</apex:outputText>
<apex:outputLabel for="NumberOfEmployees" value="Employees"/>
<apex:outputText id="NumberOfEmployees" value="{!account.NumberOfEmployees}"/>
</apex:panelGrid>
</apex:page>

 

Thanks, 

Kaity

  • July 18, 2013
  • Like
  • 0

Hello,

 

I have the following trigger:

 

I have a field on the dsfs__DocuSign_Status__c object called dsfs__Sender__c that is a text field.  I need it to be a lookup field from the User object though so I can use it for reporting.  I created another field called DocuSign_Sender__c that is a lookup to the User.  What I am trying to do with this trigger is query the User table and populate the lookup with User's id matching on the String in the dsfs__Sender__c field.  

 

I am getting this error and I'm not sure since I think my logic is pretty much correct:

 

Apex trigger populateContactfromUser caused an unexpected exception, contact your administrator: populateContactfromUser: execution of BeforeInsert caused by: System.NullPointerException: Attempt to de-reference a null object: Trigger.populateContactfromUser: line 20, column 1

 

 

trigger populateDocuSignSenderfromUser on dsfs__DocuSign_Status__c (before insert , before update){
    
    Set<String> setConIds = new Set<String>();
    
    for(dsfs__DocuSign_Status__c obj : trigger.new){
    
        if(obj.dsfs__Sender__c != null)
        
        setConIds.add(obj.dsfs__Sender__c);
    }
    
     Map <String, User> mapCon = new Map <String, User>([Select Id from User where Name in: setConIds]);
     
     for(dsfs__DocuSign_Status__c obj : trigger.new){
     
        if(obj.dsfs__Sender__c != null){
        
            User c = mapCon.get(obj.dsfs__Sender__c);
            
            obj.DocuSign_Sender__c= c.Id;

          }
       
       }
}

 

String str = 1.0 ;

 

Integer n = Integer.valueOf(str) ;

 

exection after display Invalid integer: 1.0

 

why?

 

thanks...

 

 

 

  • June 07, 2010
  • Like
  • 0

1. while a property create after..how modify as read only?

 

2. how in trigger call trigger out method?

  • June 04, 2010
  • Like
  • 0

1. Why customize see sales order object?

 

2. How see sales order object ?

 

3. How to create a field in sales order?

 

Thanks.

  • June 03, 2010
  • Like
  • 0

Hi,

 

         I am working with liveagent chatbox.. when customer click on chat button means the chatbox is open at anywhere in the page randomly but i need the chat box open at right corner bottm how can i achieve this...

  • September 02, 2013
  • Like
  • 0

hi ..

 

 I have Build a Vf page for Lead Convertion , but stuck with Controller please help me to finish this to convert the lead as the builtin Lead Convert Process but it should also create contact with it ... Cheak my Vf Code below

 

Please Correct the Visualforce page also , if any mistakes are there .....

 

My VF :

 

<apex:page standardController="lead" tabStyle="Lead" extensions="leadconvertController" >
<apex:messages />
<apex:sectionHeader title="Convert Lead"/>

<apex:form id="frm1">
<apex:pageBlock mode="edit" id="pgBlock">

<apex:pageBlockSection title="Contacts" columns="1" id="pgBlockSection">
<apex:pageBlockSectionItem id="pgBlockSectionitem">
<apex:outputText value="Create contacts now ?" />
<apex:selectRadio id="idRadio1" onclick="boolFunction(this);" >
<apex:selectOption itemValue="true" itemLabel="Yes" />
<apex:selectOption itemValue="false" itemLabel="No" />
</apex:selectRadio>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>

<span id="idSpan" style = "display:none">
<apex:pageBlock >
<apex:pageBlockSection title="Details" columns="1" id="Details">
<apex:outputLabel > <apex:pageBlock id="trainersBlock">
<apex:outputText value="Select for New ? " />
<apex:inputCheckbox id="isEmp" value="{!isChecked}" >
<apex:actionsupport event="onclick" rerender="SampleView" />
</apex:inputCheckbox>
<br></br>
<apex:outputPanel id="SampleView"><br></br>
<apex:pageBlockSection rendered="{!isChecked}">

<apex:pageBlockSectionItem id="pbsi1">
<apex:outputLabel value="First Name" for="Firstname" />
<apex:inputText id="Firstname" value="{!FirstName}" size="40"/>
</apex:pageBlockSectionItem>


<apex:pageBlockSectionItem id="pbsi2" >
<apex:outputLabel value="Last Name" for="Lastname"/>
<apex:inputText id="Lastname" value="{!LastName}" size="40"/>
</apex:pageBlockSectionItem>

 

<apex:pageBlockSectionItem >
<apex:outputLabel value="Phone" for="Phone"/>
<apex:inputText value="{!Phone}" id="Phone"></apex:inputText>
</apex:pageBlockSectionItem>



<apex:pageBlockSectionItem >
<apex:outputLabel value="Mobile" for="MobilePhone" />
<apex:inputText value="{!Mobile}" id="MobilePhone"></apex:inputText>
</apex:pageBlockSectionItem>


<apex:pageBlockSectionItem >
<apex:outputLabel value="Title" for="Title"/>
<apex:inputText value="{!Title}" id="Title"></apex:inputText>
</apex:pageBlockSectionItem>

<apex:pageBlockSectionItem >
<apex:outputLabel value="Email" for="Email"/>
<apex:inputText value="{!Email}" id="Email"></apex:inputText>
</apex:pageBlockSectionItem>

<apex:pageBlockSectionItem >
<apex:outputLabel value="Website" for="Website"/>
<apex:inputText value="{!Website}" id="Website"></apex:inputText>
</apex:pageBlockSectionItem>

<apex:pageBlockSection >
<apex:inputField value="{!lwn.ReportsToId}"/>
<apex:outputLabel />
</apex:pageBlockSection>

</apex:pageBlockSection>
<br></br>
<apex:pageBlockSection rendered="{!IF(isChecked = true , false , true)}">


<apex:pageBlockSectionItem id="pbsi" >
<apex:outputLabel value="Existing contact Name" for="contactName"/>
<apex:selectList id="contactname" value="{!contactName}" size="1" multiselect="false">
<apex:selectoptions value="{!ContactList}" />
</apex:selectList>
</apex:pageBlockSectionItem>



</apex:pageBlockSection>
</apex:outputPanel>

</apex:pageBlock> </apex:outputLabel>
</apex:pageBlockSection>
</apex:pageBlock>
</span>

</apex:form>

<script>

function boolFunction(variable)
{
var bool = variable.value;
if(bool == 'true')
{
document.getElementById('idSpan').style.display = 'block';
}
else
document.getElementById('idSpan').style.display = 'none';
}
</script>

<apex:form >
<apex:pageBlock mode="Edit">
<apex:pagemessages />

<apex:pageBlockSection title="Convert Lead" columns="1">
<apex:pageBlockSectionItem >
<apex:outputLabel value=" Record Owner" for="Record Owner"/>
<apex:inputField value="{!Lead.OwnerID}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:OutputLabel for="Send Email to the Owner">Send Email to the Owner:</apex:OutputLabel>
<apex:inputCheckbox onclick="{!Lead.Ownerid}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel for="Last Name">Last Name</apex:outputLabel>
<apex:inputField id="Name" value="{!Lead.LastName}" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel for="Account Name">Account Name</apex:outputLabel>
<apex:inputField required="true" id="Owner" value="{!Lead.Company}" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel for="Oppt Name">Opportunity Name:</apex:outputLabel>
<apex:inputField required="true" id="Owner" value="{!Lead.Company}" />
</apex:pageBlockSectionItem>
<apex:pageblockSectionItem >
<apex:outputLabel for="no oppty">Do not create new opportunity upon conversion</apex:outputLabel>
<apex:inputCheckbox required="true" onselect="{!lead.Company}"/>
</apex:pageblockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel for="ConStatus">Converted Status:</apex:outputLabel>
<apex:inputField id="ConStatus" value="{!Lead.Status}" />
</apex:pageBlockSectionItem>
</apex:pageBlockSection>






<apex:pageBlockSection title="Address Information" columns="1" id="AddressInformation">
<apex:pageBlockSectionItem >
<apex:outputLabel for="StreetAdd">Street Address:</apex:outputLabel>
<apex:inputField required="true" Id="StreetAdd" Value="{!Lead.Street}" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel for="City">City:</apex:outputLabel>
<apex:inputField required="true" Id="City" Value="{!Lead.City}" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel for="State">State:</apex:outputLabel>
<apex:inputField required="true" Id="State" Value="{!Lead.State}" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel for="Zip">Postal Code:</apex:outputLabel>
<apex:inputField required="true" Id="Zip" Value="{!Lead.PostalCode}" />
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:pageBlockSection title="Additional Information" columns="2" id="AdditionalInformation">
<apex:pageBlockSectionItem >
<apex:outputLabel for="NoofEmp">No. Of Employees:</apex:outputLabel>
<apex:inputField Id="Owner" Value="{!Lead.NumberOfEmployees}" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel for="Revenue">Annual Revenue:</apex:outputLabel>
<apex:inputField Id="Revenue" Value="{!Lead.AnnualRevenue}" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel for="Industry">Industry:</apex:outputLabel>
<apex:inputField Id="Industry" Value="{!Lead.Industry}" />
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel for="Description">Description:</apex:outputLabel>
<apex:inputField Id="Description" Value="{!Lead.Description}" />
</apex:pageBlockSectionItem>
<apex:pageblockSectionItem >
<apex:outputLabel for="Phone">Phone</apex:outputLabel>
<apex:inputField required="true" id="Phone" value="{!Lead.Phone}"/>
</apex:pageblockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel for="Email">Email</apex:outputLabel>
<apex:inputField required="true" id="Email" value="{!Lead.Email}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel for="Website">Website:</apex:outputLabel>
<apex:inputField Id="Website" Value="{!Lead.Website}" />
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:pageBlockSection title="Task Information" columns="2" id="TaskInformation">
<apex:pageBlockSectionItem >
<apex:outputLabel for="Status">Status</apex:outputLabel>
<apex:inputField value="{!Task.Status}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel for="DueDate">Due Date</apex:outputLabel>
<apex:inputField value="{!Task.ActivityDate}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel for="Priority">Priority</apex:outputLabel>
<apex:inputField value="{!Task.Priority}"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:pageBlockSection title="Description Information" columns="1" id="DescriptionInformation">
<apex:pageBlockSectionItem >
<apex:outputLabel for="Subject">Subject</apex:outputLabel>
<apex:inputField required="true" value="{!Task.Subject}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:outputLabel for="Comments">Comments</apex:outputLabel>
<apex:inputField value="{!Task.Description}"/>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem >
<apex:OutputLabel for="Send Notification Email">Send Notification Email</apex:OutputLabel>
<apex:inputCheckbox onclick=""/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:pageBlockSection title="Reminder" columns="1" id="Reminder">
<apex:pageBlockSectionItem >
<apex:outputLabel for="Reminder">Reminder</apex:outputLabel>
<apex:inputField id="Reminder" value="{!task.ReminderDateTime}"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:pageBlockButtons >
<apex:commandButton value="Convert"/>
<apex:commandButton Action="{!Cancel}" value="Cancel"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>

 

 

Controller :

 

public class leadconvertController {

 

Lead lead;
Opportunity opty;
Id optt;
Account account;
Contact contact;

public Boolean isChecked { get; set; }

public String contactName{get;set;}

public String leadName{get;set;}
public String FirstName {get; set;}
public String LastName {get; set;}
public contact lwn {get; set;}
public String Description{get;set;}

public String leadSource{get;set;}
public String leadIndustryName{get;set;}
public String leadstatus{get;set;}
public string Mobile{get;set;}
public string Phone{get;set;}
public string email{get;set;}
public string Website{get;set;}
public string leadrating{get;set;}
public string Title{get;set;}
Public String Street{get;Set;}
Public String City{get;Set;}
Public String State{get;Set;}
Public String PostalCode{get;Set;}
Public String Country{get;Set;}

public List<SelectOption> getContactList() {
Contact[] Contacts = [SELECT Id,Firstname,Lastname,name,reportstoid FROM Contact];
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('- None Selected - ','- None Selected - '));
for (Contact acc : Contacts) {
options.add(new SelectOption(acc.Name,acc.Name));
}
return options;}

public Task getTask(){
Task tsk = new Task();
return tsk;
}

public List<SelectOption> getStatus()
{
List<SelectOption> options = new List<SelectOption>();

Schema.DescribeFieldResult fieldResult = Schema.sObjectType.Lead.fields.status;
//Lead.LeadSource.getDescribe();

List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();

for( Schema.PicklistEntry f : ple)
{
options.add(new SelectOption(f.getLabel(), f.getValue()));
}
return options;
}

public List<SelectOption> getLeadIndustryNames()
{
List<SelectOption> options = new List<SelectOption>();

Schema.DescribeFieldResult fieldResult = Schema.sObjectType.Lead.fields.Industry;
//Lead.LeadSource.getDescribe();

List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();

for( Schema.PicklistEntry f : ple)
{
options.add(new SelectOption(f.getLabel(), f.getValue()));
}
return options;
}

public List<SelectOption> getPriority()
{
List<SelectOption> options = new List<SelectOption>();

Schema.DescribeFieldResult fieldResult = Schema.sObjectType.Account.fields.CustomerPriority__c;
//Lead.LeadSource.getDescribe();

List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();

for( Schema.PicklistEntry f : ple)
{
options.add(new SelectOption(f.getLabel(), f.getValue()));
}
return options;
}

public leadconvertController(ApexPages.StandardController controller) {

}


}

 

 

please provide the code for this ....

 

 

  • August 28, 2013
  • Like
  • 0

I created a custon check box at the Activity level called "Survey Offered".

 

I need for this field to be flagged as true/checked IF an email contains certain characters/text.

 

Therefore, I started to create a trigger to update the task.Survey_Offered__c = true;

 

But, I keep tripping over the coding...

 

Here is what I have been able to save so far;

 

 

trigger SurveyOffered on EmailMessage (before insert) {

for(EmailMessage message : trigger.new){

if(message.TextBody == 'createspace.force.com/HMD') {

message.ActivityId= 'SFDC_Support';

} //end trigger

}

}

 

NOW, everytime I try to insert a line to update Survey_Offered__c I am receiving error messages...

 

Any ideas?

 

 

 

I am trying to parse Date string to Date data type


While executing Anonymous code below 
Date Birthdate = date.parse('09-05-1954');
System.debug('Birthdate '+ Birthdate); 

throws exception
6:11:11.041 (41552000)|EXCEPTION_THROWN|[1]|System.TypeException: Invalid date: 09-05-1954
16:11:11.041 (41707000)|FATAL_ERROR|System.TypeException: Invalid date: 09-05-1954

But Date String with Slash works fine
Date Birthdate = date.parse('09/05/1954');
System.debug('Birthdate '+ Birthdate); 

Output

16:15:26.160 (160415000)|CODE_UNIT_STARTED|[EXTERNAL]|execute_anonymous_apex
16:15:26.161 (161357000)|USER_DEBUG|[2]|DEBUG|Birthdate 1954-09-05 00:00:00

This happens only for US locale.

 

Any idea - how to solve this?

There is a Tab named as Files in dev org by default.there are some files init. can anyone guideline how to get access to these files through Apex and  there content as Blob data type. i want to know id of these files through SOQL then how to do that

I'm presently playing with the cookbook recipe at http://developer.force.com/cookbook/recipe/uploading-a-document-using-visualforce-and-a-custom-controller

 

... and trying to figure out how to unit test this properly as I don't know how to do a "mock upload" in SFDC Apex.

 

I created this test class:

 

/**
 *	Unit Tests for Uploading a Document using Visualforce and a Custom Controller
 *  @see http://developer.force.com/cookbook/recipe/uploading-a-document-using-visualforce-and-a-custom-controller
 **/
 @isTest
private class COOK_UploadDocUsingVFPageControllerTest 
{
    public static final User TestRunner = TEST_RunAsUserFactory.create();

	private static void doUploadTest(Boolean hasName, Boolean hasBody, Boolean successExpected)
	{
		TEST_UniqueHelper uniqueHelper = new TEST_UniqueHelper('Dummy Document');
		
		Document dummyDocument = new Document();
            	 dummyDocument.name = (hasName) ? uniqueHelper.uniqueString : null;
            	 dummyDocument.body = (hasBody) ? Blob.valueOf('Unit Test Document Body') : null;
				 
		ApexPages.Message[] pageMessageArray = null;
		System.runAs(TestRunner)
        {
            Test.startTest();
            {
            	COOK_UploadDocUsingVFPageController controller = new COOK_UploadDocUsingVFPageController();
            										controller.document = dummyDocument;
													controller.upload();

				pageMessageArray = ApexPages.getMessages();
            }
            Test.stopTest();

            System.assert (pageMessageArray[0].getSeverity() == (successExpected ? ApexPages.severity.INFO : ApexPages.severity.ERROR));
            
        }
		
	}	

	public static testMethod void uploadSuccessTest()    { doUploadTest ( true,  true,  true  ); }
	public static testMethod void noNameUploadFailTest() { doUploadTest ( false, true,  false ); }
	public static testMethod void noBodyUploadFailTest() { doUploadTest ( true,  false, false ); } // TODO: Resolve why this test fails!
	

}

 but my final testMethod, noBodyUploadFailTest() is itself a failure, resulting in System.AssertException:Assertion Failed.

 

Any ideas how I should fix this?

 

 

 

Hello,

 

I'm getting error: Too many SOQL queries: 101 Trigger.UpdateTableLink: line 16, column 1. Line 16 in my code is

 

 List<Country_Codes__C> ICC = [Select id, Country_Name__c from Country_codes__C Where Country_Name__c in :CountryNames ];  

 

Below is my full code. Please advise on how to fix with specific code examples.

 

trigger UpdateTableLink on Account (before insert, before update) {
 
   Set<String> CountryNames = new Set<String>();

    for (Account a : Trigger.new){
      if (a.ShippingCountry == NULL){
      a.ShippingCountry = 'NONE';   
        }

    if (a.ShippingCountry <> NULL){
      CountryNames.add((a.ShippingCountry.toUpperCase()));   
        }}

    List<Country_Codes__C> CC = [Select id, Country_Name__c from Country_codes__C Where Country_Name__c in :CountryNames ];  

    Map <String, ID> map1 = new Map<String, ID>();
    for (Country_Codes__c countryRecord: CC) {
        map1.put(countryRecord.Country_Name__c, countryRecord.Id);
    }

    for (Account a : Trigger.new)
 if (a.ShippingCountry <> NULL){
      {   
        a.CountryCodesLink__c = map1.get(a.ShippingCountry.toUppercase());

      }  }
}

 

Hi,

 

I am getting an error when trying to login into Site based portal.

 

I am getting this error only sometimes.

 

Error: Error occurred while loading a Visualforce page. 

 

All the pages are given access to Site and Profile.

 

We have a query on User object, Is this casuing the issue? 

 

Please help.

 

Thanks! 

 

Regards,

Lucky

I know I am missing something simple here, but I getting a:

 

Apex script unhandled trigger exception by user/organization: 0055000000118E4/00D50000000784t

Update_NCOA_Address_v01: System.LimitException: Too many DML rows: 10001

 

Error Message.

 

1.  Can someone spot my error?

2.  Is there a way to put into the code or error message which record(s) triggered the error?

 

trigger Update_NCOA_Address_v01 on printsf__Collateral_Send_History__c(after insert, after update) {
    // Update the appropriate SD_Member__c record with NCOA address from PrintSF
    List<SD_Member__c > recordsToUpdate = new List<SD_Member__c >();
    For(printsf__Collateral_Send_History__c CSH: Trigger.new) {
        // Get the SD Member Id from the recipient id field 
        //String strSDId = CSH.printsf__Recipient_ID__c;

// Check to see if it is an SD Member Entry        
If(CSH.printsf__Recipient_ID__c!=null){   
     
        If(CSH.printsf__NCOA_Result__c == 'None') {
            SD_Member__c SD = New SD_Member__c(id = CSH.printsf__Recipient_ID__c,
                NCOA_Address__c = CSH.printsf__Street__c,
                NCOA_City__c = CSH.printsf__city__c,
                NCOA_State__c = CSH.printsf__State__c,
                NCOA_Zip__c = CSH.printsf__Zip_Code__c,
                NCOA_Error_Code__c = CSH.printsf__NCOA_Result__c,
                NCOA_Error_Description__c = CSH.printsf__NCOA_Result_Description__c);
            recordsToUpdate.add(SD);
        }

        If(CSH.printsf__NCOA_Result__c == 'Fowarded') {
            SD_Member__c SD = New SD_Member__c(id = CSH.printsf__Recipient_ID__c,
                NCOA_Address__c = CSH.printsf__Street__c,
                NCOA_City__c = CSH.printsf__city__c,
                NCOA_State__c = CSH.printsf__State__c,
                NCOA_Zip__c = CSH.printsf__Zip_Code__c);
            recordsToUpdate.add(SD);
        }

        If(CSH.printsf__NCOA_Result__c == 'Failed') {
            SD_Member__c SD = New SD_Member__c(id = CSH.printsf__Recipient_ID__c,
                NCOA_Address__c = CSH.printsf__Street__c,
                NCOA_City__c = CSH.printsf__city__c,
                NCOA_State__c = CSH.printsf__State__c,
                NCOA_Zip__c = CSH.printsf__Zip_Code__c,
                Address_Bad__c = True);

            recordsToUpdate.add(SD);
        }

    
  
  update recordsToUpdate;
}

}}

 Thanks for the help.

Hi, 

 

I am trying to update an Account's name using the StandardController save method. For some reason the update is not happening. Here is my code: 

 

public with sharing class UpdateAccountClass{

	public ApexPages.StandardController s;
	public Account a {get; Set;}
	
	public UpdateAccountClass(ApexPages.StandardController stdCon){
		s = stdCon;
		a = (Account)stdCon.getRecord();
		a = [select id, Name from Account where Id =: a.Id];
	}
	
	public PageReference SaveRecord(){
		a.Name = 'Testing Testing';
		PageReference p = null;
		try{	
			p = s.save();
		}catch(Exception e){
			system.debug(e.getMessage());
		}
		return p;
	}
}

 

Thank you in advance. 

Hi All,

 

I have a custom objects called Deal__c ,Document_Type__c,Uploaded_Documents__c . 

 

Uploaded_Documents__c has a lookup relationship to Deal__c 

 

Uploaded_Documents__c  has  a lookup relationship to Document_Type__c

 

Content (Standard object) has lookup to Deal__c

 

Content (standard object) has lookup to Document_Type__c.

 

 

There a visualforce page(custom link from Deal__c)  where they upload the document.There is another visualforce page basicially has the checklist of documents(document type) (custom link from Deal__c) which shows the list of  documents that got uploaded and also the list of documents which needs to be uploaded to close the deal

 

On insert of document there is trigger on Deal__c which creates Uploaded_Documents__c record for each insert of the record.

 

The issue is  if there is any update of document type  like deleting the document type (means removing from the document checklist) will remove the correspoding link to 2nd visualforce page.

 

We don't want to affect the deals that already has some document uploaded.we just want to affect the deals for newly created ones.

 

I need some help on how to handle document type think just like checklist of document types which gets changed frequently.

 

 

 

how to display the current user  name in  textbox using controller  ? (Sample Code)

HI All,

 

I am craeting  a dynamic table in VF.In the table in each row first 2 column is generating from parent record and the rest four column is generating from child.For this I am iterating with two repeat .But the issue is , my td in table is gerating according to the size of the child record. I want every time the table should comlete whether the record is there or less in child object.

 

Can any one suggest me for this.

Thanks

Situ

 

Am developing a custom object "Detail" where am getting details like Name ,Mobile num, Account ID.Am also adding a custom field "Acc Id " in  Accounts object. Before saving the Details record, i want to check,whether the Account Id is existing in Accounts..how it can be checked?

 

Hi All,

 

when i am enabling chatter in my sandbox its showing error like this..

 

can you please help me on this.

  • August 08, 2013
  • Like
  • 0

Hi Developers ,

Im new to SFDC .

Can anyone help me in this coding part where im facing an ERROR.

 

 Error: Compile Error: unexpected token: ')' at line 14 column 61
// Sample prg to Delete the records of object a using Batch Apex.

global class Deletea implements Database.Batchable
{
global final string query;
global deletea__c(string q);
{
query=q;
}
global Database.QueryLocator start(Database.Batchablecontext BC)
{
return Database.getQueryLocator(query);
}
global void execute(Database.BatchableContext BC,List <scope>)
{
list<a__c> lista= new list<a__c>();
for(Sobjects s :scope)
{
(a__c) a = (a__c)s;
lista.add(a)
}
Delete lista;
}
global void finish(Database.Batchablecontext BC)
{
//Send an email to the User after your batch complete
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
String[] ToAddresses = new String[] {‘xyz@gmail.com’};
mail.setToAddresses(ToAddresses);
mail.setSubject('Apex Batch Job is done‘);
mail.setPlainTextBody('The batch Apex job processed ');
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
}
}

 

Thanks in Advance

  • August 07, 2013
  • Like
  • 0