• J Cesar
  • NEWBIE
  • 125 Points
  • Member since 2016
  • Senior Salesforce Developer
  • Centelon


  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 16
    Replies
HI, I have a problem with this trigger, I am not able to update the fields contact_lago__c :(
Here's the code:
//this trigger assign an owner for each Candidatura Discover based on score.
trigger AssignOwnerDiscover on Candidatura_Tenant__c (before insert,before update) {
    //Set<ID> ids = Trigger.newMap.keySet();
    List<Candidatura_Tenant__c> c = [SELECT Id,punteggio__c,contact_lago__c,Lead__r.Country FROM Candidatura_Tenant__c WHERE Id in :Trigger.newMap.keySet()];
    if (c.size()==0)
        return;
    for(Candidatura_Tenant__c i: c){
        if(i.punteggio__c >=21){
            if(i.Lead__r.Country=='IT')
                i.contact_lago__c ='003c000000hafFz';
            else 
                i.contact_lago__c ='003a000001v34dh';
        }
        else{
                if(i.punteggio__c >14)
                    i.contact_lago__c ='00313000028crUg';
                else
                    i.contact_lago__c =i.Lead__r.Agente__c;
        }
   }
}
Thanks in advance!

Our client needs to import millions of records into Salesforce, we are talking of volumes from 6 to 200 million records per object. What tools can we use, and how long would it take us to import 6 million records?

Informatica can certainly handle it but it would be an overkill, the use case doesn't justify the costs. The preference is on free tools because it's a one-off operation.

If you've used Jitterbit to import millions of records, how long did it take?

I need to display a list of child objects related to a master record, each with a list of child objects, and some fields across both levels need to be available for inline editing.
The structure is as follows:
  • Master record (only passes the ID as reference to the controller for SOQL query)
  • List of child objects Child__c with a lookup to Master__c, each with a 
  • List of child objects of Child__c, Grandchild__c, with a lookup to Child__c
I have no experience with nested lists in VF, any advice how to go about this one would be greatly appreciated.
 
I was thinking of a wrapper class, but how would I go about implementing nested lists in a wrapper class as they need to be ordered?
The query on the controller side pulls out the following:
SELECT Id, Name, Master__c, Quantity__c, Price__c, (SELECT Id, Name, Quantity__c FROM Grandchildren__r) FROM Child__c WHERE Master__c = :MasterId

Save button would update both lists...

Scenerio - 

There will be two org, one salesforce and another non-salesforce. 

What we need to do is to search account in both the orgs and display the output on VF page.
Can anyone help with the api or can shed some light ?

For HTML we do make file with .html
Like wise for visualforce?

Hi
I have created two record types for contact object.
I have a custom picklist displaye don vf page which has record types of contact object as picklist values.
I have a vf page called "contactsedit" which I want to display based on user selection in picklist.
In picklist if user selects record_type_1 then, the page "contactsedit" would be called with the customized selections made for record_type_1.
Here I will insert values into and save to UI.
similary in picklist if user selects "record_type_2" then the page "contactsedit" would be called with the customized selections made for record_type_2.
Here is the code.
public with sharing class bindrecordtypepicklist
{ 
   list<SelectOption> options {get;set;} 
 
   public String selectedRecordType{get;set;} 

   private Contact con;
   
   public bindrecordtypepicklist(ApexPages.StandardController stdcontroller)
   {
       this.con = (Contact)stdController.getRecord();
   }
   public list<SelectOption> getRecordTypes() 
   { 
      options = new list<SelectOption>(); 
      options.add(new selectOption('', '- None -'));
      for(RecordType rt:[SELECT Name FROM RecordType WHERE SobjectType = 'Contact' AND IsActive=True]) 
      { 
         if(rt != null) 
         {
           options.add(new SelectOption(rt.ID,rt.Name)); 
         }
      } 
      return options; 
  }   
  public void CallContactsEditPage()
  {
   //
  }
}

<apex:page standardController="Contact"
           extensions="bindrecordtypepicklist">
 <apex:form id="TheForm"> 
 <apex:pageblock > 
    <apex:outputLabel > <b>Record Types</b> : </apex:outputLabel> 
    <apex:selectList size="1" 
                     value="{!selectedRecordType}"
                     multiselect="false"> 
    <apex:selectOptions value="{!RecordTypes }"/> 
      <apex:actionSupport event="onchange"
                          action="{!CallContactsEditPage}"
                          reRender="TheForm"/>
    </apex:selectList> <br/> 
  </apex:pageblock> 
 <h1>You have selected :<apex:outputLabel value="{!selectedRecordType}"
                                          id="TheForm"/></h1>
  </apex:form> 
</apex:page>

contactedit visual force page
-----------------------------
<apex:page standardController="Contact">
	<apex:sectionHeader title="Contact Edit" subtitle="{!Contact.Name}"></apex:sectionHeader>
	<p>Contacts not associated with accounts are private and cannot be viewed by other users or included in reports.</p>
	<apex:pageMessages></apex:pageMessages>
	<apex:form>
		<apex:pageBlock title="Contact Edit" id="pageBlock" mode="edit">
			<apex:pageBlockButtons>
				<apex:commandButton action="{!save}" value="Save"></apex:commandButton>
				<apex:commandButton action="{!cancel}" value="Cancel"></apex:commandButton>
			</apex:pageBlockButtons>
			<apex:pageBlockSection columns="2" title="Contact Information">
				<apex:inputField value="{!Contact.Salutation}"></apex:inputField>
				<apex:inputField value="{!Contact.FirstName}"></apex:inputField>
				<apex:inputField value="{!Contact.Phone}"></apex:inputField>
				<apex:inputField value="{!Contact.LastName}" 
                                                 required="true"></apex:inputField>

			<apex:inputField value="{!Contact.MobilePhone}"></apex:inputField>
				<apex:inputField value="{!Contact.AccountId}"></apex:inputField>
				<apex:inputField value="{!Contact.LeadSource}"></apex:inputField>
				<apex:inputField value="{!Contact.Birthdate}"></apex:inputField>
				<apex:inputField value="{!Contact.Email}"></apex:inputField>
				<apex:inputField value="{!Contact.Title}"></apex:inputField>
				<apex:inputField value="{!Contact.Fax}"></apex:inputField>
				<apex:inputField value="{!Contact.Department}"></apex:inputField>
			</apex:pageBlockSection>
		</apex:pageBlock>
	</apex:form>
</apex:page>
so when the user selects picklist value "record_type_1" the contactsedit page should be loaded with the selections made for recordtype "record_type_1"
Pls help me.

thanks
pooja

 
HI,

We are using the standard Account page layouts. I was wondering what it would take to make a button conditionally show if a specific criteria was met. I am unable to find anything that allows a button to show up on a page layout conditionally. I know we can create custom page layouts and assign it per profile, but that is not the scenario. Ideally, based on the field values, the button should display or disappear. 

What is the recommended way to accomplish this?
I am getting maximum trigger dept exceeded error, because (1) Account After update trigger is updating opportunities (used in SF2SF updates)   (2) Opportunity After Update trigger is updating account information (internal sales process)

I used to have #2 scenario in workflow rules, that I have to move to trigger due to WF rule limit. I am using static variable but I am still getting this error. How can I identify/differentiate #1 and #2 scenario in Trigger and prevent this recursive calling.  Any suggestions?

 
I need to create a test class for an apex trigger in order to upload it from sandbox to production. I need help creating the test class as I am failry new at Salesforce development. Here is the apex trigger:

trigger Appointment_Closed on i360__Appointment__c (before insert) {
List<ID> ProspectIds = New List<ID>();
    
   for(i360__Appointment__c o : Trigger.new){
    if(o.i360__Result__c == 'Sold' | o.i360__Prospect__c != null){
      ProspectIds.add(o.i360__Prospect__c);
    }
  }
   List<i360__Prospect__c> ProspectList = [SELECT id, Appointment_Closed__c FROM i360__Prospect__c WHERE id in :ProspectIds];
  for(integer i = 0 ; i < ProspectList.size(); i++){
      ProspectList[i].Appointment_Closed__c = 1;
  
  }
  update ProspectList;
}
Just wrote my first trigger and i need to write a test class for it. I'm not sure how to go about this. but it's a before update trigger (see below) and all it does is update a field on the Opportunity if another field is changed and is a certain value. I know i need to write a test class for this trigger to go into PROD.Thoughts on this one?

trigger UpdateOldStage on Opportunity (before insert, before Update) 
{
    for(Opportunity opp : trigger.new)
    {
        Opportunity oldopp = trigger.oldMap.get(opp.id);
        {
        If(opp.New_Stage__c != NULL)
        {
                If( opp.New_Stage__c != oldopp.New_Stage__c && opp.New_Stage__c == 'Close Opportunity')
                {
                    opp.StageName = 'Category 1';
                }
                else if(opp.New_Stage__c != oldopp.New_Stage__c && opp.New_Stage__c == 'Generate Opportunity')
                {
                    opp.StageName = 'Category 4';
                }  
                else if(opp.New_Stage__c != oldopp.New_Stage__c && opp.New_Stage__c == 'Gain Sponsorship')
                {
                    opp.StageName = 'Category 3';
                }
                else if(opp.New_Stage__c != oldopp.New_Stage__c && opp.New_Stage__c == 'Confirm Solution')
                {
                    opp.StageName = 'Category 2';
                }
                else if(opp.New_Stage__c != oldopp.New_Stage__c && opp.New_Stage__c == 'Closed/No Decision')
                {
                    opp.StageName = 'Closed/No Decision';
                }
                else if(opp.New_Stage__c != oldopp.New_Stage__c && opp.New_Stage__c == 'Closed Lost')
                {
                    opp.StageName = 'Closed Lost';
                }
       }
       }
    }
}
HI, I have a problem with this trigger, I am not able to update the fields contact_lago__c :(
Here's the code:
//this trigger assign an owner for each Candidatura Discover based on score.
trigger AssignOwnerDiscover on Candidatura_Tenant__c (before insert,before update) {
    //Set<ID> ids = Trigger.newMap.keySet();
    List<Candidatura_Tenant__c> c = [SELECT Id,punteggio__c,contact_lago__c,Lead__r.Country FROM Candidatura_Tenant__c WHERE Id in :Trigger.newMap.keySet()];
    if (c.size()==0)
        return;
    for(Candidatura_Tenant__c i: c){
        if(i.punteggio__c >=21){
            if(i.Lead__r.Country=='IT')
                i.contact_lago__c ='003c000000hafFz';
            else 
                i.contact_lago__c ='003a000001v34dh';
        }
        else{
                if(i.punteggio__c >14)
                    i.contact_lago__c ='00313000028crUg';
                else
                    i.contact_lago__c =i.Lead__r.Agente__c;
        }
   }
}
Thanks in advance!
i have two objects in first obj qualification and experiance fields are there in second obj one look up field is there and also qualification and experience are there if i am  set a look up two fields also want to automatically will sets using look up
Hello All,
I have completed this challenge.

1-For this first you need to create a helper formula field(type-percent) 
Percent Completed :
(DATEVALUE( CreatedDate ) - CloseDate )/100


2- Then you need to create the actual formula field (type- text) by using the helper formula field.
Opportunity Progress :

IF( Percent_Completed__c <=25,"Early", 
IF(Percent_Completed__c <=75,"Middle", 
"Late"))

Thanks,
Nida