• meera
  • NEWBIE
  • 79 Points
  • Member since 2009

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 14
    Replies

I have a multi-currency enabled org. Using the VF outfield tag , we are displaying a currency on Sites - The default currency of the the guest user is set of EUR- but the pricelist that applies to this usecase is in  CHF (Swiss Franc) , So the price is displayed as in this format  "CHF 308.00 (EUR 308.00)" - 

 

Is there a way to hide the EUR portion of the price, and just display the price in CHF?

 

Note that, I do not want to use outputText as i want to take advantage of the currency formatting provided by outputField tag...

 

Thanks

 

Hi all

i got some issues i am listing out here.please respond as early as possible.

if we search a company it displays 100 records with same company name located in different places.can we sort the records by certain criteria like sort by stateor sort by city .

please reply very urgent

  • May 18, 2010
  • Like
  • 0

Has anyone figured out a creative way to manage single email methods given the 10 message governor limit?  For example, If I have an email method set-up to send out a message upon an opportunity closing, then we can't update more than 10 opportunities at a time (single trigger execution) without hitting this limit.

 

Can't use built-in workflow/email alerts because the data for the email message is coming from more than 1 object and we need to have control over the to:, cc: fields.

 

Looking for any creative ideas here.

Hi Experts,

I have a contact lookup in Opportunity and Near to contact look up field, I need to show a new Contact button/Link in Opportunity Edit screen.

We cannot enable quick create since there are some security issues.

I tried using home page link javascript, but that is not working and New Contact link is getting loaded only when I click on home page link.

Is there any other method that you can suggest to implement this?

User-added image
Thanks
Meera



 
  • November 11, 2015
  • Like
  • 0
Hi Experts,

I have a requirement in which when I am creating a new record, I will do one validation in trigger and if the validation failed, I need to add error and fail that record. And I need to send an email to the account owner informing about the error. But when I tried when the add error is getting executed, email notification is not send. Is there any way that we can execute both?

Thanks
Meera
  • September 23, 2014
  • Like
  • 0
Hi there,

Im trying to write a Task trigger which checks the parent object type of the task.  Once the type is known, there are steps of logic e.g.  If Opportunity Task - do this.  If Lead Task - do that.

Im trying to save my code, but keep getting the following error:  
Error: Compile Error: Variable does not exist: ObjectTaskMap at line 48 column 17

I dont know why its telling me that the variable doesnt exist.  Can anyone help, or point me in the direction of similar code?  My code is below.  

Thanks in advance!!

trigger TaskTrigger on Task (before insert, before update) 
{
    string str = '';
    
    List<Id> ObjectIds=new List<Id>();
    for(Task t:trigger.new)
    {
        if(t.Status=='Completed')
        {
            if(t.whatId != null && String.valueOf(t.whatId).startsWith('006')==TRUE) //check if the task is associated with an Opp
            {
                ObjectIds.add(t.whatId);
                str = 'Opportunity';
                //System.debug('In here:' + t.whatid);
            }//if 2
            
            
            Else if(t.whoId != null && String.valueOf(t.whoId).startsWith('00Q')==TRUE) //check if the task is associated with an Opp
            {
                ObjectIds.add(t.whoId);
                str = 'Lead';
                //System.debug('In here:' + t.whoid);
            }//if 2
                
        }//if 1
    }//for
     

    if(str == 'Opportunity')
    {
        map<id,Opportunity> ObjectTaskMap = new map<id,Opportunity>([SELECT Id, Situation__c, Problem__c, Implication__c, Need_Payoff__c , StageName, (Select ID From OpportunityLineItems) FROM Opportunity WHERE Id IN :ObjectIds]);
    
        List<OpportunityContactRole> OCR = [select id from OpportunityContactRole where OpportunityId IN :ObjectIds];
    }
    
    Else If(str == 'Lead')
    {
        map<id,Lead> ObjectTaskMap = new map<id,Lead>([SELECT Id, Description, Status FROM Lead WHERE Id IN :ObjectIds AND IsConverted=FALSE]);
    }
       
    
    for(Task tsk:trigger.new)
    {   
      if(ObjectTaskMap.keyset().contains(tsk.whatid))
      {
            if(tsk.Status == 'Completed' && tsk.Subject == 'Communicate with Client')
            {
                ObjectTaskMap.get(tsk.whatid).StageName = '2-Identified';
                //System.debug('Communicate with Client:' + ObjectTaskMap.get(tsk.whatid).StageName);
            }
            
            Else if( tsk.Status == 'Completed' && tsk.Subject == 'Validate Opportunity')
            {
                If (ObjectTaskMap.get(tsk.whatid).Situation__c == Null ||  ObjectTaskMap.get(tsk.whatid).Problem__c == Null || ObjectTaskMap.get(tsk.whatid).Implication__c == Null || ObjectTaskMap.get(tsk.whatid).Need_Payoff__c == Null)
                {
                    tsk.adderror('Task cannot be completed until the following Opportunity fields have been populated: Situation, Problem, Implication, Need & PayOff');
                }
                Else
                {
                    ObjectTaskMap.get(tsk.whatid).StageName = '3-Validated';
                }
                    
            }
            
                    
            Else if(tsk.Status == 'Completed' && tsk.Subject == 'Qualify Opportunity and Identify Contact Roles')
            {
                If (ObjectTaskMap.get(tsk.whatid).OpportunityLineItems.isEmpty() || OCR.size()==0) 
                {
                    tsk.adderror('Task cannot be completed until Contact Roles AND Products have been added to the Opportunity');
                }
                Else
                {
                    ObjectTaskMap.get(tsk.whatid).StageName = '4-Qualified';
                }
            }
            
            Else if(tsk.Status == 'Completed' && tsk.Subject == 'Create quote and submit to Client')
            {
                ObjectTaskMap.get(tsk.whatid).StageName = '5-Proposal';
            }
            
            Else if(tsk.Status == 'Completed' && tsk.Subject == 'Proposal Outcome')
            {
                If (tsk.Proposal_Outcome__c == 'Commercial Agreement')
                {
                    ObjectTaskMap.get(tsk.whatid).StageName = '6-Commercial Agreement';
                }
                Else If (tsk.Proposal_Outcome__c == 'Lost')
                {
                    If (tsk.Loss_Abandonment_Reason__c == Null)
                    {
                        tsk.adderror('Please enter a reason for Loss / Abandonment');
                    }
                    Else
                    {
                        ObjectTaskMap.get(tsk.whatid).StageName = '9-Lost';
                        ObjectTaskMap.get(tsk.whatid).Opportunity_Loss_Abandoned_Reason__c = tsk.Loss_Abandonment_Reason__c;
                        ObjectTaskMap.get(tsk.whatid).Opp_Other_Loss_Abandonment_Comments__c = tsk.Other_Loss_Abandonment_Comments__c;
                    }
                }
                Else
                {
                    If (tsk.Loss_Abandonment_Reason__c == Null)
                    {
                        tsk.adderror('Please enter a reason for Loss / Abandonment');
                    }
                    Else
                    {
                        ObjectTaskMap.get(tsk.whatid).StageName = '8-Abandoned';
                        ObjectTaskMap.get(tsk.whatid).Opportunity_Loss_Abandoned_Reason__c = tsk.Loss_Abandonment_Reason__c;
                        ObjectTaskMap.get(tsk.whatid).Opp_Other_Loss_Abandonment_Comments__c = tsk.Other_Loss_Abandonment_Comments__c;
                    }
                }
            }
            
            Else if(tsk.Status == 'Completed' && tsk.Subject == 'Opportunity Outcome')
            {
                If (tsk.Opportunity_Outcome__c == 'Won')
                {
                    ObjectTaskMap.get(tsk.whatid).StageName = '7-Won';
                }
                Else If (tsk.Opportunity_Outcome__c == 'Lost')
                {
                    If (tsk.Loss_Abandonment_Reason__c == Null)
                    {
                        tsk.adderror('Please enter a reason for Loss / Abandonment');
                    }
                    Else
                    {
                        ObjectTaskMap.get(tsk.whatid).StageName = '9-Lost';
                        ObjectTaskMap.get(tsk.whatid).Opportunity_Loss_Abandoned_Reason__c = tsk.Loss_Abandonment_Reason__c;
                        ObjectTaskMap.get(tsk.whatid).Opp_Other_Loss_Abandonment_Comments__c = tsk.Other_Loss_Abandonment_Comments__c;
                    }
                }
                Else
                {
                    If (tsk.Loss_Abandonment_Reason__c == Null)
                    {
                        tsk.adderror('Please enter a reason for Loss / Abandonment');
                    }
                    Else
                    {
                        ObjectTaskMap.get(tsk.whatid).StageName = '8-Abandoned';
                        ObjectTaskMap.get(tsk.whatid).Opportunity_Loss_Abandoned_Reason__c = tsk.Loss_Abandonment_Reason__c;
                        ObjectTaskMap.get(tsk.whatid).Opp_Other_Loss_Abandonment_Comments__c = tsk.Other_Loss_Abandonment_Comments__c;
                    }
                }
            }
            
            Else 
            {
                //ObjectTaskMap.get(tsk.whatid).StageName = '7-Won';
            }
      }
        Else If(ObjectTaskMap.keyset().contains(tsk.whoid))
        {
            if(tsk.Status == 'Completed' && tsk.Subject == 'Make contact with Lead')
            {
                ObjectTaskMap.get(tsk.whoid).Status = 'Contacted';
            }
            
            //  System.debug('1 condition:' + ObjectTaskMap.get(tsk.whoid).Description == NULL);
            //  System.debug('2 condition:' + tsk.Status == 'Completed');
            //  System.debug('3 condition:' + tsk.Subject == 'Make contact with Lead');
            //  System.debug('task:' + tsk);
            
            Else if(ObjectTaskMap.get(tsk.whoid).Description == Null && tsk.Status == 'Completed' && tsk.Subject == 'Qualify Lead')
            {
                tsk.adderror('Task cannot be completed until the following LEAD fields have been populated: Description');
            }
            Else 
            {
                ObjectTaskMap.get(tsk.whoid).Status = 'Qualified';
            }
        }
    
    
    }
    
    if(str == 'Opportunity')
    {
        List<Opportunity> ObjectList = ObjectTaskMap.values();
        update ObjectList;
    }
    Else if(str == 'Lead')
    {
        List<Lead> ObjectList = ObjectTaskMap.values(); 
        update ObjectList;
    }  
}
Hi friends,
There are two lookup fields (contact and account) on lead object. My requirement is: when user creates a lead, lead no. which is an autonumber field should be auto populated on respective contact and account records.
do i need to write a trigger for this? if is there any other solution pls suggest.

Thanks & regards
Manish Verma
 
Hi Experts,

I have a requirement in which when I am creating a new record, I will do one validation in trigger and if the validation failed, I need to add error and fail that record. And I need to send an email to the account owner informing about the error. But when I tried when the add error is getting executed, email notification is not send. Is there any way that we can execute both?

Thanks
Meera
  • September 23, 2014
  • Like
  • 0
Hi All,

DId not find a similar question in the past so here it goes:
We have created a custom clone functionality. What this does is clone the record, empty some fields, update the parents, and then inserts the record in the database. Afterwards the page is redirected to the edit page of the record.

However, the standard Salesforce Edit detail record page has a cancel button. This cancel button just directs to the ?retURL paramters. So it will go back the to detail view. 

Because we performed the clone and we needed to insert this cloned record into the DB before redirecting to the Edit page, the record will not be 'cancelled' in the way of cancellation the entire clone. So the record must be deleted again.

Is there a way to capture the Cancel event? Or to redirect the page to the edit detail view of the record without inserting it into the DB? So then the user can still Click on Save and we have the requisted functionality. 

Thanks,
Robin 
  • September 11, 2014
  • Like
  • 1

Hii All,

I have Scenario

that i made custom fireld

DATA Type:picklist

Field:Days__c

values{MOn,Tue,Wed,Thu,Fri,Sat,Sun]

and i have to get the o/p as Name :Mike NUmber of  working daysDays :4

 

 

public with sharing class Workdays

{

  public Workdays() {  }

 Account a = new Account();

 List<Account> a1; 

public list<Account> getAcclist()

 {  return a1; }

 public PageReference Attendance()

 {

 a1=[select count(id),name,Days__c from Account where name=:a.name Group by Days__c];

 public Account getAccount() {  return a; }

 

}

and i'm getting ERror:ErrorError: Compile Error: Field must be grouped or aggregated: Name at line 14 column 6

 

can u plz guide how to apply group by function for this code

Thanks in Advance

 

I have a requirement to create a visuaforce page which shows data with is parent-child (one-to-many) relationships.

This scenario gets a little more complex if any of the child records contain children of their own (i.e.,  grandkids).  

 

For example, a bicycle is a top-level assembly that contains parts such as posts, wheels brakes and more.  Each of these parts can also contain multiple parts.   A wheel is a sub-assembly of the bicycle which  is composed of a rim, tire, spokes etcetera.  These sub-assemblies can further contain component parts and sub-assemblies of their own (e.g.,  hubs, chain rings and bearings).    

A Parts List table is used to store child records for the parts, relating them to parent records with a key field such as Parent Assembly ID.  

 

this is more like a bill of material.  For example (Indenture Level in parentheses):

                    -Bicycle (0)
                          - Wheel assembly (1)
                                - Rims (2)
                                - Tires (2)
                                - Hub assembly (2)
                                      - Sprockets (3)
                                      - Derailier (3)
                                      - Etc. (3)
                          - Brake assembly (1)
                                - Pads (2)
                                - Cables (2)
                                - Etc. (2)
                         - Etc (1)

 

 

 

I will really appreciate if some one can post an example of VF page and Apex controller to achive this.

 

Thanks

 

 

 

I have a multi-currency enabled org. Using the VF outfield tag , we are displaying a currency on Sites - The default currency of the the guest user is set of EUR- but the pricelist that applies to this usecase is in  CHF (Swiss Franc) , So the price is displayed as in this format  "CHF 308.00 (EUR 308.00)" - 

 

Is there a way to hide the EUR portion of the price, and just display the price in CHF?

 

Note that, I do not want to use outputText as i want to take advantage of the currency formatting provided by outputField tag...

 

Thanks

 

Hi all

i got some issues i am listing out here.please respond as early as possible.

if we search a company it displays 100 records with same company name located in different places.can we sort the records by certain criteria like sort by stateor sort by city .

please reply very urgent

  • May 18, 2010
  • Like
  • 0

Hi All,

I have been facing difficulty while deleting the trigger from my production environment. I followed the steps given in this site : http://theenforcer.net/2008/12/how-to-delete-triggers-in-production/

However, it doesn't give you the option to delete the trigger as shown in following image.

http://i36.tinypic.com/29onwp2.jpg

 

I also noticed that it doesn't even give me the option to add the new trigger to the production.

Has anybody been through the same problem?

 

I would really appreciate for the hel.

 

Thanks in Advance,

Manish

  • October 15, 2009
  • Like
  • 0

Has anyone figured out a creative way to manage single email methods given the 10 message governor limit?  For example, If I have an email method set-up to send out a message upon an opportunity closing, then we can't update more than 10 opportunities at a time (single trigger execution) without hitting this limit.

 

Can't use built-in workflow/email alerts because the data for the email message is coming from more than 1 object and we need to have control over the to:, cc: fields.

 

Looking for any creative ideas here.

Hi All

We have a huge issue of duplicates. So I'm creating a contact dupe check VF page. Whenever the user clicks on New, the user has to be directed to this dupe check page, where in after a search, he either skips entering a contact, or continues to the actual create new contact page.

 

I have created the Dupe Check Page (below) with an extension. Now I want to be able to direct the user to the create new page when he clicks continue. I'm unable to understand how to do this. The problem is

 

1. When I replace the New button . On Clicking New, SF takes me to the record type selection page. And then the VF page. Now how do I save the recordtype that the user selected?

 

2. When I click on continue, how do I pass the parameters - First Name, Last Name, Email, Account Name, Record type to the create new page? And most importantly how do I go to the actual create New page?

Any help will be greatly appreciated. Thank you. 

 

<apex:page standardController="Contact" extensions="ContactDupeCheck"><apex:form >

<apex:pageBlock title="Quick Dupe Check">

<apex:pageBlockSection columns="2">

<apex:pageBlockSectionItem >

<apex:outputLabel value="First Name" for="fname"/>

<apex:inputtext value="{!fName}" id="fname"/>

</apex:pageBlockSectionItem>

<apex:pageBlockSectionItem >

<apex:outputLabel value="Last Name" for="lname"/>

 

<apex:inputText value="{!lName}" id="lname"/>

</apex:pageBlockSectionItem>

<apex:pageBlockSectionItem >

<apex:outputLabel value="Email" for="email"/>

<apex:inputtext value="{!eemail}" id="email"/>

</apex:pageBlockSectionItem>

<apex:pageBlockSectionItem >  

<apex:outputLabel value="Account Name" for="accName"/>  

<apex:inputText value="{!aname}" id="accname"/> 

</apex:pageBlockSectionItem>  

</apex:pageBlockSection>  

<apex:commandButton action="{!dupecheck}" value="Find Dupes" rerender="listing" status="status">

<apex:actionSupport event="onchange" rerender="listing"/></apex:commandButton>

<apex:actionstatus id="status" startText="processing...">

<apex:facet name="stop"></apex:facet> </apex:actionstatus>

</apex:pageBlock>

<apex:pageBlock title="Possible Dupes" >

<apex:pageBlockSection id="listing" columns="1">

<apex:pageBlockTable rows="10" value="{!conList}" var="c" border="0" cellspacing="0" cellpadding="10">

<apex:column ><a href = "/{!c.Id}">Click Here</a></apex:column>

<apex:column value="{!c.FirstName}"/>

<apex:column value="{!c.LastName}"/>

<apex:column value="{!c.Email}"/>  

<apex:column value="{!c.Title}"/>  

<apex:column value="{!c.AccountId}"/>  

<apex:column value="{!c.Account.Account_Manager__c}"/>  

<apex:column value="{!c.Account.NBR__c}"/>  

<apex:column value="{!c.Account.Territory__c}"/>  

<apex:column value="{!c.Account.OwnerId}"/>  

</apex:pageBlockTable>  

</apex:pageBlockSection>  

<apex:commandButton action="{!cancel}" value="Cancel"></apex:commandButton>

<apex:commandButton action="{!add}" value="Continue"></apex:commandButton>

</apex:pageBlock>

</apex:form>

</apex:page>

 

 

---Extension

 

 

public without sharing class ContactDupeCheck {

private final Contact cont;

public ContactDupeCheck(ApexPages.StandardController controller){

this.cont = (Contact)controller.getRecord();

}

Public List<Contact> conList = new List<Contact>();

public List<Contact> getConList(){

 

return conList;

}

public void setConList(List<Contact> conList){

this.conList = conList;

}

String aname;

public String getaname(){

 

return aname; }

public void setaname(String aname){

this.aname = aname;

}

String lname;

public String getlname(){

return lname;

}

 

public void setlname(String lname){

 

this.lname = lname;

}

String fname;

	public String getfname(){
		return fname;
	}
	public void setfname(String fname){
		this.fname = fname;
	}	
String eemail;	public String geteemail(){
		return eemail;	
}	public void seteemail(String eemail){
		this.eemail = eemail;	}	
public PageReference DupeCheck(){
		system.debug('IM IN');
		if(conList==null)
			conList = new List<Contact>();
		String querystring = 'select Id, FirstName, LastName, Title, AccountId, Email, Contact.Account.OwnerId, 						Contact.Account.Account_Manager__c, Contact.Account.NBR__c, Contact.Account.Territory__c from Contact where ';				String lnamefilter = 'LastName LIKE \'%' + String.escapeSingleQuotes(lName) + '%\'';		
		String emailfilter = 'Email LIKE \'%' + String.escapeSingleQuotes(eemail) + '%\'';		
		String fnamefilter = 'FirstName LIKE \'%' + String.escapeSingleQuotes(fName) + '%\'';		
		String anamefilter = ' Contact.Account.Name Like \'%' + String.escapeSingleQuotes(aname) + '%\'';		
		String conqstring  = querystring;		
		Set<Id> cids = new Set<Id>();		
		if(eEmail.length()!=0){			
			System.debug('IN E');			
			conqstring+=emailfilter;			
			conList = Database.query(conqstring);			
			for(Contact c :conList)				
			cids.add(c.Id);		}			
	if(aname.length()!=0 && lName.length()!=0 && fName.length()!=0){
			System.debug('IN A');			
			querystring+=anamefilter+' and '+ lnamefilter+' and ' + fnamefilter;
			for(Contact c :Database.query(querystring)){
				if(!cids.contains(c.Id)){
					conList.add(c);	
				cids.add(c.Id);		
		}	
		}		
}		
else{			
		System.debug('IN N');			
		if(lName.length()!=0 && fName.length()!=0){
				querystring+=lnamefilter + ' and ' + fnamefilter;
				for(Contact c :Database.query(querystring))
					if(!cids.contains(c.Id)){
					conList.add(c);	
				cids.add(c.Id);	
 
}			
}		
}								
		System.debug('FINAL QUERY STRING'+querystring);				
return null;	
}	
public PageReference add(){
		//PageReference rtpage = new PageReference();		
	Map<String,String> BaseURL = ApexPages.currentPage().getHeaders();
		for(String s :BaseUrl.keyset())			
System.debug('BaseUrl::::::::'+BaseUrl.get(s));		
return null;	

} 

 

 

Message Edited by withoutme on 07-30-2009 02:25 AM
Message Edited by withoutme on 07-30-2009 02:30 AM