• Abhay Arora
  • SMARTIE
  • 1308 Points
  • Member since 2012

  • Chatter
    Feed
  • 50
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 225
    Replies

Hi,

can any one help what is the attribute that i need to set for  displaying   two Pageblocktables in same pageblocksection side by side.

 

 

Thanks&Regards,

Veerendra

Hi,

 

i have a field called "err"  which of type 'String' in controller if its value is null then i have to display some message in visual force page. If it is not null than no message has to be displayed.

 

How can we do it. I tried but i am not getting.

 

<apex:pageMessage summary="{!Err}" severity="warning" rendered="IF(ISBLANK({!Err}),true,false)" id="errID" />

 

It is urgent.

 

Thanks,

Bujji

  • June 05, 2012
  • Like
  • 0

Hi,

 

Need to have a page where the inputText field must be activated only when the checkbox next to it is tagged.

Can you please provide me an example?

 

Thanks.

Hi,

 

How can we do the below format in visualforce page.

 

 

I am not getting this format exactly.Its urgent thanks you.

 

Thanks,

Bujji

  • May 31, 2012
  • Like
  • 0

Hi All,

 

To read the GET parameters from the URL, we use:
ApexPages.currentPage().getParameters().get(<name>);

How can I read POST parameters from the URL ?

 

Thanks,
Pragati

Hi ,

 

I have a requirement where i  am routing user from a vf page to standard case creation page , i need to prepopulate some fields on case while routing.

 

Any idea how to do this .

 

Thanks

Ritika

Is there a way to send mass email to a custom object with an email template?  

 

 

 

Thanks in advance

I'm kind of a newbie, so please excuse if this is simplistic - but I can't find anything on it. Here goes:

 

WIthin Visualforce, is it possible to look at a cell in ANOTHER row and format the current cell based on it what it finds?

 

In Excel's conditional formatting it would be something like =IF(A2 <> A1, black, grey)

 

All I want is to change the style of  a cell if the one above it is the same, giving me:

 

Type SKU
Switch17982
Switch17983
Switch17985
Button17988
Button17989
Knob19827
Knob19829

 

 

While something like this could be achieved within the controller, I'm trying to make it work on a Visualforce page so that if dynamic filters within the page are applied, the page formatting adjusts without having to do another query.

 

I did find another post which does something similar within the same row, (Re: conditional styling in table), but there's no mention of how this type of referential access might be achieved within a table.

 

Has anyone done something similar? If so, how did you manage? Any help is most appreciated.

 

 

I'm creating a custom Visualforce page to override the standard page layout of a custom object, however I'm having an issue when it comes to adding a clone button to the Visualforce page. On the standard page layout for this custom object, I'm able to view and use the Clone button. For some reason, when I try to add the same Clone button to the Visualforce page, I get the following error:

 

Error: action="{!clone}": Unknown method 'O__cStandardController.clone()'

 

Am I doing something wrong? I checked the metadata for my custom object, and there is a clone action in the metadata. It seems silly to me that even though it's there on the standard page layout, I can't access it when creating a Visualforce page so I'm guessing I'm calling the action incorrectly.

 

I'd really appreciate any help! I have only the most basic knowledge of creating extensions, so I'd rather avoid doing so if I can.

 

Thank you!

Hi

I am getting No Records in the page showing No Units to display
can any one help me in this

I have created a Button and calling the below VF :
I have the following code for VF and Controller
++++++++++++++++++++Page++++++++++++++++++++
<apex:page StandardController="Project__c" extensions="Add_Units_Site_Project">
 <apex:form >
 <apex:outputPanel >
  <apex:pageBlock id="pageblock">
 
     <apex:pageBlockButtons >         
     <apex:commandButton Value="Process Selected Units" onclick="return validateSelection1();"/>
     <apex:commandButton Value="Go Back" action="{!cancel}" />
     </apex:pageBlockButtons>
     
     <apex:pageBlockSection title="Unit Events" id="unitevents" columns="1" collapsible="true" >
     
     
     
     <apex:pageBlockTable value="{!uniteventlist}" id="TableData" var="u">
     <!--rendered="{!NOT(ISNULL(uniteventlist))}"   -->
     
     <apex:column headerValue="Select All" >    
     <apex:facet name="header">
     <apex:inputCheckbox id="chkSelectAll"  title="Select All" value="{!chkFlag}">
     <apex:actionSupport event="onclick" action="{!chkAllBox}" />
     </apex:inputCheckbox>
     </apex:facet>
     <apex:selectCheckboxes value="{!Selected}" id="ids" >
     <apex:selectOption itemvalue="{!u.ID}"  />
     </apex:selectCheckBoxes>
     </apex:column>
     <apex:column headerValue="Unit Event Id"><apex:outputField value="{!u.Otg_ID__c}"/></apex:column>
     
     <apex:column headerValue="Outage Type"> <apex:outputField value="{!u.Otg_Type__c}"/></apex:column>
     <apex:column headerValue="Outage Quarter"> <apex:outputField value="{!u.Otg_Qtr__c}"/></apex:column>
        
     </apex:pageBlockTable>
     <apex:outputLabel value="No Units are available for this Site Outage Project Account" rendered="{!NoOfUnits == 0}"> </apex:outputLabel>
     
     </apex:pageblocksection>
     
     <apex:pageBlockButtons location="bottom" rendered="{!NOT(ISNULL(uniteventlist))}">
        <table width="100%"  rendered="{!NOT(ISNULL(uniteventlist))}"><tr></tr><tr><td align="left">
        <apex:commandLink value="<< First" action="{!getFirst}" reRender="pageblock" rendered="{!hasFirst}" />
        <apex:outputText value="<< First" rendered="{!NOT(hasFirst)}" /> &nbsp;
        <apex:commandLink value="< Previous" action="{!getPrev}" reRender="pageblock" rendered="{!hasPrev}" />
        <apex:outputText value="< Previous" rendered="{!NOT(hasPrev)}" /> &nbsp;
        <apex:commandLink value="Next >" action="{!getNext}" reRender="pageblock" rendered="{!hasNext}" />
        <apex:outputText value="Next >" rendered="{!NOT(hasNext)}" /> &nbsp;
        <apex:commandLink value="Last >>" action="{!getLast}" reRender="pageblock" rendered="{!hasLast}" />
        <apex:outputText value="Last >>" rendered="{!NOT(hasLast)}" /> &nbsp;
        </td><td align="right">
        <apex:outputText >Records {!StartRec}-{!EndRec} of {!NoOfUnits} </apex:outputText>
        </td></tr></table>
     </apex:pageBlockButtons>
    
     
  </apex:pageBlock>
  </apex:outputpanel>
 </apex:form>
 
  <script type="text/javascript">

    var selectedCount = 0;  
    function validateSelection1()
    {        
        var inputElem = document.getElementsByTagName("input");
        for(var i=0; i<inputElem.length; i++)
        {
        
        if(inputElem[i].id.indexOf("ids")!=-1 || inputElem[i].id.indexOf("chkSelectAll")!=-1)
        {
            if(inputElem[i].checked==true)
            {
            selectedCount=1;
            }
        }   
    }
     if(selectedCount == 0)
      {
          alert('Select a Unit to add to the Site Outage Project ');
          return false;
      }
        return true;
    }  

  </script>

</apex:page>

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
And the Controller as follows :
++++++++++++++++++Contoller +++++++++++++++++++++++++++++++++++
Public Class Add_Units_Site_Project{

Public Project__c proj {get;set;}
//Public Installed__c IB {get;set;}
//Public Outage_c units {get;set;}
Public List <Installed> IBlist = new List <Installed>();
Public List <Outage__c> Units = new List <Outage__c>();
Private String projid;
Public String Accid;
Public Integer NoOfUnits{get;set;}
Private Integer NextCount=0;
Public Integer NoOfRows=20;
Public Boolean hasNext{get;set;}
Public Boolean hasPrev{get;set;}
Public Boolean hasFirst{get;set;}
Public Boolean hasLast{get;set;}
Public Integer StartRec{get;set;}
Public Integer EndRec{get;set;}
Public void getNext()
    {
        if(NextCount+NoOfRows <= NoOfUnits)
            NextCount+=NoOfRows;
        else
            NextCount = NoOfUnits - NoOfRows;
    }
    Public void getPrev()
    {
        if(NextCount-NoOfRows >=0)
            NextCount-=NoOfRows;
        else
            NextCount=0;
    }
    Public void getFirst()
    {
        NextCount=0;
    }
    Public void getLast()
    {
        NextCount=NoOfUnits - NoOfRows;
    }

    public Add_Units_Site_Project(ApexPages.StandardController controller) {
       //Fetching the Current Record ID
         projid =ApexPages.currentPage().getParameters().get('id');
         proj =[select id,name,Account__c,Account__r.id,Account_Name__c,RecordTypeid from Project__c where id =: projid];        
         
         //Fetching Current Record Account ID
         Accid = [select id,name from Account where id =:proj.Account__c].id;
         
         IBlist = [Select id,name,Account__r.id from Installed__c where Account__c = : Accid];
         Units = [Select id,name,S_N__c,Site_Outage_project__c from Outage__c where S_N__c in : IBList ];
         
    }
    
 public List<Outage__c> uniteventlist= new List<Outage__c>();
 public List<Outage__c> getuniteventlist() {

    if(uniteventlist.size()==0)
        return null;
   
    For(Integer i=0; i<NoOfRows && NextCount+i < NoOfUnits; i++)
    {
       Units.add(uniteventlist[NextCount+i]);
    }
     if(NextCount <= 0)    
            {
                hasFirst=False;
                hasPrev=False;
            }
            else
            {
                hasFirst=True;
                hasPrev=True;
            }
            if(NextCount >= (NoOfUnits - NoOfRows))
            {
                hasLast=False;
                hasNext=False;
            }
            else
            {
            
                hasLast=True;
                hasNext=True;
            }

            StartRec=(NoOfUnits == 0)?0:NextCount+1;
            if(StartRec+NoOfRows > NoOfUnits)
                EndRec=NoOfUnits;
            else
                EndRec=StartRec+NoOfRows -1;
     
    if(Units.size()>0)
        return Units ;
    else { return null; }
 
    }
 public boolean chkFlag{get; set;}
    
    public void chkAllBox()
    {
        if(chkFlag == true)
        {
            for(outage__c unitevnts : uniteventlist )
            {
                Selected.add(unitevnts.id);
            }
        }
        else
        Selected.clear();
    }
    public id[] selected = new  id[]{};
    public id[] getSelected()
    {
       return Selected;
    }
    public void setSelected(id[] selected)
    {  
       if(chkFlag == false)
       this.Selected.addAll(selected);
    }



}

  • May 25, 2012
  • Like
  • 0

All i want to do is Don't repeat the red part of the code, and i must keep it in the same position of the it:

how can I do? 

 

<apex:pageblock >
<apex:repeat value="{!ExpOth}" var="experience" id="RepExp" rendered="{!IF(CONTAINS('skill','Client'), false, true)}">
<apex:repeat value="{!experience.Skills_Techical__r}" var="skillexperience" id="RepSkillExp" rendered="{!IF(CONTAINS('skill','Client'), false, true)}">

 

<apex:outputtext value="Skill aggiuntivi" rendered="{!IF(experience.Skills_Techical__r=null ,false,true)}" escape="false" />&nbsp;
<hr>
</hr>

 

 

<apex:outputtext value="Skill:" rendered="{!IF(experience.Skills_Techical__r=null ,false,true)}" escape="false" />
<apex:outputfield value="{!skillexperience.Position_name__c}"/>
- &nbsp; <apex:outputfield value="{!skillexperience.Skill_Area_name__c}"/><br/>



</apex:repeat>
</apex:repeat>
</apex:pageblock>

 

 

Thanks in advance

I am using google visualization api to draw column chart on apex page but, in controller i am getting error

 

public with sharing class GoogleColumnChartController {

public List<Account> accList { get; set; }

public GoogleColumnChartController(){
accList = [ SELECT Id,Name,Total_Sales__c,Total_Expense__c FROM Account ];

}

 

public String getSalesData(){
GoogleViz gv = new GoogleViz();

gv.cols = new list<GoogleViz.col> {
new GoogleViz.Col('col1','Year','Year'),
new GoogleViz.Col('col2', 'Salse','Sales'),
new GoogleViz.Col('col3','Expense','Expense')
};

for ( Account acc : accList ){

GoogleViz.row r = new GoogleViz.row();

r.cells.add ( new GoogleViz.cell(acc.Total_Sales__c) );
r.cells.add ( new GoogleViz.cell(acc.Total_Expense__c) );
}

return gv.toJsonString();
}

 

please , help me why error come at GoogleViz line i have see many examples on devloperforce using this class object.

but i am getting this error which decrease my interust to use the Visulization api.

 

anything need to use this GoogleViz in apex class if any then please assist me....

Hi friends when i try to insert the date into the filed using mail iam getting the below,Please help me in solving this error . I have pasted the Apex Code below."

 

554 System.NullPointerException: Argument 2 cannot be null "

 

global class JobHandler implements Messaging.InboundEmailHandler
{
global Messaging.InboundEmailResult handleInboundEmail(Messaging.InboundEmail email, Messaging.InboundEnvelope envelope)
{
Messaging.InboundEmailResult result = new Messaging.InboundEmailresult();
Job_Application__c JA=new Job_application__c();
map<string,integer> monthmap=new map<String,Integer>{'January'=>1,'February'=>2,'March'=>3,'April'=>4,'May'=>5,'June'=>6,'July'=>7,'August'=>8,'September'=>8,'October'=>10,'November'=>11,'December'=>12};
String[] emailBody = email.plainTextBody.split('\n',0);
for(Integer i=0; i<emailbody.size(); i++)
{
Integer j=0;
if(emailbody[i].contains('Candidate:'))
{
List<String> can=emailBody[i].split('Candidate:');
string[] s=can[can.size()-1].split(' ');
String cdtName=s[s.size()-1];
candidate__c c=[select id,name from candidate__c where Name=:cdtName limit 1];
system.debug('Candidate id is'+c.Id);
JA.Candidate__c=c.Id;
system.debug(s);
}
else if(emailbody[i].contains('Position:'))
{

List<String> pos=emailBody[i].split('Position:');
string[] ps=pos[pos.size()-1].split(' ');
//String Posname=pos[pos.size()-1];
String Posname=pos[pos.size()-1];
Position__c p=[select id,Name from Position__c where Name=:Posname limit 1];
System.debug('Postion Id is'+p.Id);
Ja.POsition__c=p.id;
system.debug(ps);
}
else if(emailbody[i].contains('Status:'))
{
List<String> Sta=emailBody[i].split('Status:');
if(sta[sta.size()-1]!=' ')
ja.Status__c=sta[sta.size()-1];
}
else if(emailBody[i].contains('Hire Date:'))
{
List<String> date11=emailBody[i].split('Hire Date:');
if(date11[date11.size()-1]!=' ')
{
// List<String> date12=emailBody[i].split('/');
string[] s1=date11[date11.size()-1].split('/');
string days=s1[s1.size()-3;
string month=s1[s1.size()-2];
string year=s1[s1.size()-1];
Date dt=Date.newInstance(Integer.valueof(days),monthmap.get(month),Integer.valueof(year));
JA.Hire_Date__c=dt;
//system.debug('The date is:'+JA.Hire_Date__c);
}
}
}
insert JA;
//system.debug('Inserted Application:'+JA);
return result;
}
}

  • May 25, 2012
  • Like
  • 0

Hello

 

I develped an HTTP Callout to an internal system.

We basically issue a call to create a new record in a database, and in return we get the ID of the newly created record .

 

I created a Visualforce page for a custom object, called WS.

The page has a controller extension.

This page has a custom button, which calls an action defined in the controller extension. The action issues the callout to the WS.

 

When I get my response back, I would like to update a the WS record with the data I receive back from the callout.

 

What is the best way to do this?

 

Thanks a lot in advance

Giorgio

 

 

Hi,

 

I am trying to run the test class for the below apex class, but I am getting issue attempt to de-reference a null object:

at line "ownerids.add(AssetRecord.OwnerId)".

Even though I am able to see the value at line   system.debug('**** AssetRecords OwnerId ' + AssetRecord.OwnerId);


 

APEX CLASS:

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


global class OpportunitiesAmounts implements
                                    Database.Batchable<SObject>{
 
 private final List<Id> ownerids;

 private final String template = 'Sample Template';
 private static Map<Id,Id> opportunityrevenueMap = new Map<Id,Id>();
 private static Map<Id,string> EquipmentrevenueMap = new Map<Id,string>();
 
 global Database.queryLocator
                         start(Database.BatchableContext ctx){
  string query = 'select Id, Equipment_Title__c, Total_Revenue__c from Equipment__c  where Total_Revenue__c >= 100000' ;                  
  return Database.getQueryLocator(query);                       
  }                                                      
 
 global void execute(Database.BatchableContext BC, List<sObject> scope)
  {
   for(Sobject EquipmentItem : scope )
   {
    EquipmentrevenueMap.put(string.valueof(EquipmentItem.get('Id')), string.valueof(EquipmentItem.get('Equipment_title__c')));
   }
  List<Opportunity> opportunityEquipmentList = [select Id, Equipment__c, Asset__c from Opportunity
                                   where Equipment__c IN :EquipmentrevenueMap.KeySet()];                                                                
  for(Opportunity opportunityItem : opportunityEquipmentList)
  {
   opportunityrevenueMap.put(opportunityItem.Asset__c,opportunityItem.Id);
  }  
  for(Asset__c AssetRecord : [select Id, OwnerId,Name from Asset__c
                                    where Id in :opportunityrevenueMap.KeySet()])  {
                                    
    system.debug('**** AssetRecords Id ' + AssetRecord.Id);
    system.debug('**** AssetRecords Name ' + AssetRecord.Name);
    system.debug('**** AssetRecords OwnerId ' + AssetRecord.OwnerId);
                                 
    ownerids.add(AssetRecord.OwnerId);
  }
 
  if(ownerids.size() > 0) {  
   Messaging.MassEmailMessage mail = new Messaging.MassEmailMessage();
   mail.setTargetObjectIds(ownerids);
   mail.setTemplateId([select Id from EmailTemplate where Name = :template].Id);
   Messaging.SendEmail(new Messaging.MassEmailMessage[] { mail });
  }    
  }

  global void finish(Database.BatchableContext BC)
  {
  }
   
 }

 

Note: Infact I am populating owner id value with UserInfo.getUserId() in test class and the system.debug('**** AssetRecords OwnerId ' + AssetRecord.OwnerId) also displays the same id.

 

Please help me on resolving this issue.

 

Thanks,

JBabu.

 

  • May 21, 2012
  • Like
  • 0

Please someone help on how to resolve this error.  What's the best practice on handling it?  Appreciate response.  Thanks

 

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

 

Apex script unhandled trigger exception by user/organization: 005U0000000NmC0/00DU0000000KA1N

 

trac_Attachment: execution of AfterInsert

 

caused by: System.DmlException: Update failed. First exception on row 0 with id 00QU0000005c15jMAA; first error: UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record: []

 

Trigger.trac_Attachment: line 112, column 1

 

trigger trac_Attachment on Attachment (before delete, after insert, after update) {
	String BASE_URL = Url.getSalesforceBaseUrl().toExternalForm() + '/servlet/servlet.FileDownload?file=';
	String OWNER1 = 'Owner1_Sign.png';
	String OWNER2 = 'Owner2_Sign.png';
	String PG1 = 'Owner1_PG_Sign.png';
	String PG2 = 'Owner2_PG_Sign.png';
	Map<Id,Lead> leadMap = new Map<Id,Lead>();

	Set<Id> touchedLeadIds = new Set<Id>();
	for (Attachment lp : trigger.isdelete ? trigger.old : trigger.new) {
		touchedLeadIds.add(lp.parentId);
	}

	leadMap = new Map<Id,Lead>([SELECT IsConverted, DirtyFlag__c, Conga_Owner1_PG_Sign_URL__c, Conga_Owner2_PG_Sign_URL__c,
												    Conga_Owner1_Sign_URL__c, Conga_Owner2_Sign_URL__c
											 FROM Lead
											 WHERE Id IN :touchedLeadIds]);
	
	for(Lead i : leadMap.values()){
		if(i.IsConverted == false && i.DirtyFlag__c == true) i.DirtyFlag__c = false;
		else if(i.IsConverted == false) i.DirtyFlag__c = true;
	}	
	
	// find relevant opp ids
	Set<Id> oppIds = new Set<Id>();
	Set<Id> leadIds = new Set<Id>();
	for(Attachment a : trigger.isdelete ? trigger.old : trigger.new) {
		if (a.name == OWNER1 || a.name == OWNER2 || a.name == PG1 || a.name == PG2) {
			if (((String)a.parentId).startsWith('006')) {
				oppIds.add(a.parentId);
			} else if (((String)a.parentId).startsWith('00Q')) {
				leadIds.add(a.parentId);
			}
		}
	}
	
	
	if ((oppIds.size() + leadIds.size()) > 0) {
		// get opps and leads
		Map<Id,Opportunity> oppMap = new Map<Id,Opportunity>([SELECT Conga_Owner1_PG_Sign_URL__c, Conga_Owner2_PG_Sign_URL__c,
																	 Conga_Owner1_Sign_URL__c, Conga_Owner2_Sign_URL__c
															  FROM Opportunity
															  WHERE Id IN :oppIds]);
		
		Boolean isLead;
		for(Attachment a : trigger.isdelete ? trigger.old : trigger.new) {
			if (((String)a.parentId).startsWith('00Q') || ((String)a.parentId).startsWith('006')) {
				isLead = ((String)a.parentId).startsWith('00Q');
				system.debug('isLead is: ' + isLead + ', a.name is: ' + a.name);
			} // end parentid if
		} // end for
		update oppMap.values();
	}
	update leadMap.values();	
}

 

  • May 19, 2012
  • Like
  • 0

Hi,

 

I have a requirement where I need to display opportunities which are not worked upon for more than 15 days.

I need to show them.

I have created the class.

 

But for test class, I am facing an issue. If I insert test data in to the opportunity object. The last modified date would be the current date.

So there wont be any records which are satistying my criterion (without action for more than 15 days).

And code coverage is not happening properly.

Also "LastModifiedDate" field is not updateable.

Moreover if query the system for data without creating test data, we might not have any opportunities without any activity for more than 15 days.

 

Please suggest me if any one knows any means to tackle this issue.

 

Thanks,

JBabu.

 

  • May 18, 2012
  • Like
  • 0

Getting too many soql queries 101 even though no queries in loop.  how do I overcome this?  very frustrating.

 

code is long so divided into two posts.

 

trigger trac_Lead on Lead (before insert, before update, after insert, after update) {
		
	/*****************
	 * Before Insert *
	 *****************/
	 
	if(trigger.isInsert && trigger.isBefore) {
		// Perform SIC mappings
		for(Lead l : trigger.new) {
			if (l.sic_lookup__c != null) {
				l.Industry = l.sic_description__c;
			}
		}
		
		// Query campaigns and rates
		List<Campaign> campaignList = new List<Campaign>();
		for(Campaign i : DBHelper.getCampaignListQuery()){
			if(i.IsActive==true){
				campaignList.add(i);
			}
		}

		List<User> userList = DBHelper.getUserDetailQuery();

		for (Lead l : trigger.new) {
			
			for(User u : userList){
				if(u.Id == UserInfo.getUserId()){
					if(u.Account_ID__c != null) {
						for(Account a : DBHelper.getAccountQuery()){ //check if accountid on user detail is valid
							if(a.Id == u.Account_ID__c){
								l.Payment_Advisor__c = u.Account_ID__c;
							}
						}
					}
				}				
			}
						
			// Inject default rates to app from campaign
	        if (l.Campaign__c != null && l.Product_Group__c != null && l.Processor__c != null) {
	      
	      		Campaign matchingCampaign;
	      		for(Campaign c : campaignList){
	      				if(c.Id==l.Campaign__c) {
	      					matchingCampaign = c;
	      					break;
	      				}
	      		}
	      		
	      		Id selectedRate;
	      		if(l.Processor__c == 'FD') {
	      			if(l.Product_Group__c == 'Mobile') selectedRate = matchingCampaign.FD_Mobile_Rate__c;
	      			else if(l.Product_Group__c == 'In-Store') selectedRate = matchingCampaign.FD_Instore_Rate__c;
	      			else if(l.Product_Group__c == 'Online') selectedRate = matchingCampaign.FD_Online_Rate__c;
	      		}
	      		else if(l.Processor__c == 'Chase') {
	      			if(l.Product_Group__c == 'Mobile') selectedRate = matchingCampaign.Mobile_Rate__c;
	      			else if(l.Product_Group__c == 'In-Store') selectedRate = matchingCampaign.Rate__c;
	      			else if(l.Product_Group__c == 'Online') selectedRate = matchingCampaign.Online_Rate__c;	
	      		}
	      		else if(l.Processor__c == 'PsiGate') {
	      			if(l.Product_Group__c == 'Mobile') selectedRate = matchingCampaign.PsiGate_Mobile_Rate__c;
	      			else if(l.Product_Group__c == 'In-Store') selectedRate = matchingCampaign.PsiGate_Instore_Rate__c;
	      			else if(l.Product_Group__c == 'Online') selectedRate = matchingCampaign.PsiGate_Online_Rate__c;	
	      		}
	      		
	      		for(Rate__c r : DBHelper.getRateListQuery()){
	      				if(r.Id==selectedRate) {
							l.Account_Setup_Fee__c = r.Account_Setup_Fee__c;
							l.Amex_JCB_Fee_del__c = r.Amex_JCB_Fee_del__c;
							l.Annual_Fee__c = r.Annual_Fee__c;
							l.Chargeback__c = r.Chargeback_del__c;
							l.Cross_Border_Fee__c = r.Cross_Border_Fee__c;
							l.Deconversion_Cancellation_Fee_per_loc__c = r.Deconversion_Cancellation_Fee_per_loc__c;
							l.Discover_Rate__c = r.Discover_Rate__c;
							l.Discover_Rate_Amount__c = r.Discover_Transaction_Fee__c;
							l.Interac_Fee__c = r.Interac_Fee__c;
							l.MC_VISA_Authorization__c = r.MC_VISA_Authorization__c;
							l.MasterCard_Cross_Border_Transaction_Fee__c = r.MasterCard_Cross_Border_Transaction_Fee__c;
							l.MasterCard_Rate__c = r.MasterCard_Rate__c;
							l.MasterCard_Rate_Amount__c = r.MasterCard_Transaction_Fee__c;
							l.Monthly_Account_Fee__c = r.Monthly_Account_Fee__c;
							l.Monthly_Minimums__c = r.Monthly_Minimums__c;
							l.Non_Qualifying_Surcharge_Fee__c = r.Non_Qualifying_Surcharge_Fee__c;
							l.Other_Monthly_Fees__c = r.Other_Monthly_Fees__c;
							l.VISA_Debit_Rate__c = r.VISA_Debit_Rate__c;
							l.VISA_Debit_Rate_Amount__c = r.VISA_Debit_Transaction_Fee__c;
							l.VISA_MasterCard_Card_Brand_Fee__c = r.VISA_MasterCard_Card_Brand_Fee__c;
							l.Visa_Rate__c = r.VISA_Rate__c;
							l.VISA_Rate_Amount__c = r.VISA_Transaction_Fee__c;
							l.Voice_Authorization__c = r.Voice_Authorization__c;
							l.Wireless_Terminal_Setup_Fee__c = r.Wireless_Terminal_Setup_Fee__c;
	      					break;
	      				}
	      		}
	        }
		}
	}

	/****************
	 * After Insert *
	 ****************/
	 
	if(trigger.isInsert && trigger.isAfter) {
		// add campaign mappings
		List<CampaignMember> newCMs = new List<CampaignMember>();
		List<Web_Profile__c> newWPs = new List<Web_Profile__c>();
		
		for (Lead l : trigger.new) {
			if(UserInfo.getUserId() != '005U0000000NmC0'){
				newWPs.add(new Web_Profile__c(Applicant__c = l.id, Email__c = l.Email));
			}
			newCMs.add(new CampaignMember(leadid = l.id, campaignid = l.campaign__c));
		}
		insert newCMs;

		try {
			insert newWPs;
		} catch (DmlException de) {
			for (Lead l : trigger.new) {
				l.addError('Duplicate Email with an existing lead.');
			}
		}
			
	}
	
	/*****************
	 * Before Update *
	 *****************/
	
	if(trigger.isUpdate && trigger.isBefore) {
	
		Set<Id> leadIds = new Set<Id>();
		for (Lead lp : trigger.new) {
			leadIds.add(lp.id);
		}
	
		List<Lead_Product__c> leadProductQuery = null;
		
		leadProductQuery = [SELECT lead__c, product__r.isActive, 
										Card_Types__c,
										Doing_Business_As_DBA__c,
										Quantity__c,
										Term__c,
										Product__c,
										product__r.purchase_price__c,
										product__r.rental_price__c,
										product__r.lease_price__c,
										Batch_Processing__c,
										Customer_Profile_Management__c,
										Recurring_Billing__c,
										Shopping_Cart_Option__c,
										Virtual_Terminal__c,
										Auto_Close_Hour__c,
										Auto_Close_Minute__c,
										Auto_Close__c,
										Cash_Back_Enabled__c,
										Invoice_Number__c,
										QSR_Flag__c,
										Server_Clerk_ID__c,
										Tip_Option__c,
										Connection_Type__c,
										DNS1__c,
										DNS2__c,
										Gateway_Address__c,
										IP_Address__c,
										Request_Type__c,
										Service_Option__c,
										Special_Instructions__c,
										Subnet_Mask__c,
										Add_to_Existing_NetConnect__c,
										Application_Type__c,
										Existing_NetConnect_ID__c,
										Software_Name_Version__c,
										TID_s__c,
										VAR_Comm_Method__c,
										VAR_Name__c,
										Rental_Cost__c,
										Rental_Price__c,
										Lease_Price__c,
										Purchase_Price__c,
										Buy_Rate__c
										FROM Lead_Product__c WHERE lead__c IN :leadIds];
	
		Id LEAD_RT_UNCLAIMED;
		Id LEAD_RT_MANUAL;
		for(RecordType rt : DBHelper.getRecordTypes()) {
			if(rt.SobjectType=='Lead' && rt.name=='Unclaimed Lead'){
				LEAD_RT_UNCLAIMED = rt.id;
			}
			if(rt.SobjectType=='Lead' && rt.name=='Manually Entered'){
				LEAD_RT_MANUAL = rt.id;
			}
		}	
	
		List<CampaignMember> newCMs = new List<CampaignMember>();
		Set<String> delCMKeys = new Set<String>();
		
		List<Lead_Product__c> lps = new List<Lead_Product__c>();
		for(Lead_Product__c i : leadProductQuery){
			if(leadIds.contains((Id)i.lead__c)){
				lps.add(i);
			}
		}
		
		// check that lead has products
		Set<Id> leadsWithProducts = new Set<Id>();
		for(Lead_Product__c i : lps) {
			if(!leadsWithProducts.contains((Id)i.lead__c)){
				leadsWithProducts.add((Id)i.lead__c);				
			}
		}
		
		// check for lead products that have inactive products	
		Set<Id> leadsWithInactiveProducts = new Set<Id>();
		for(Lead_Product__c i : lps) {
			if(!leadsWithInactiveProducts.contains((Id)i.lead__c) && i.product__r.isActive == false){
				leadsWithInactiveProducts.add((Id)i.lead__c);
			}
		}
		
		// Query campaigns and rates
		List<Campaign> campaignList = new List<Campaign>();
		for(Campaign i : DBHelper.getCampaignListQuery()){
			if(i.IsActive==true){
				campaignList.add(i);
			}
		}											 
		
		for (Lead l : trigger.new) {
			
			// assign record type based on whether owner is queue or a user
			if(((String)l.ownerid).startsWith('00G')) { // queue
				l.recordtypeid = LEAD_RT_UNCLAIMED;
			} else if (l.recordtypeid == LEAD_RT_UNCLAIMED){ // user, needs RT update
				l.recordtypeid = LEAD_RT_MANUAL;
			}
			
			// lead is about to be converted
			if (l.isConverted && !trigger.oldMap.get(l.id).isConverted) {
				if(!leadsWithProducts.contains(l.id)) {
					l.addError(system.label.noLeadProducts);
				} else if(leadsWithInactiveProducts.contains(l.id)) {
					l.addError(system.label.leadProductWithInactiveProduct);
				}
				
				l.status_date_review_and_sign__c = Datetime.now();
			}
			
			if (l.sic_lookup__c != null) {
				l.Industry = l.sic_description__c;
			}
			
			// Find leads where the campaign has been changed
			if(l.campaign__c != trigger.oldMap.get(l.id).campaign__c) {
				newCMs.add(new CampaignMember(leadid = l.id, campaignid = l.campaign__c));
				if (trigger.oldmap.get(l.id).campaign__c != null) {
					delCMKeys.add(((String)trigger.oldmap.get(l.id).campaign__c).substring(0,15) + ((String)l.id).substring(0,15));
				}
			}
			
			// Update rates if campaign, processor, or product group changed
			Lead oldLead = Trigger.oldMap.get(l.ID);
	        if (l.Campaign__c != oldLead.Campaign__c || l.Product_Group__c != oldLead.Product_Group__c || l.Processor__c != oldLead.Processor__c) {
	      
	      		Campaign matchingCampaign;
	      		for(Campaign c : campaignList){
	      				if(c.Id==l.Campaign__c) {
	      					matchingCampaign = c;
	      					break;
	      				}
	      		}
	      		
	      		Id selectedRate;
	      		if(l.Processor__c == 'FD') {
	      			if(l.Product_Group__c == 'Mobile') selectedRate = matchingCampaign.FD_Mobile_Rate__c;
	      			else if(l.Product_Group__c == 'In-Store') selectedRate = matchingCampaign.FD_Instore_Rate__c;
	      			else if(l.Product_Group__c == 'Online') selectedRate = matchingCampaign.FD_Online_Rate__c;
	      		}
	      		else if(l.Processor__c == 'Chase') {
	      			if(l.Product_Group__c == 'Mobile') selectedRate = matchingCampaign.Mobile_Rate__c;
	      			else if(l.Product_Group__c == 'In-Store') selectedRate = matchingCampaign.Rate__c;
	      			else if(l.Product_Group__c == 'Online') selectedRate = matchingCampaign.Online_Rate__c;	
	      		}
	      		else if(l.Processor__c == 'PsiGate') {
	      			if(l.Product_Group__c == 'Mobile') selectedRate = matchingCampaign.PsiGate_Mobile_Rate__c;
	      			else if(l.Product_Group__c == 'In-Store') selectedRate = matchingCampaign.PsiGate_Instore_Rate__c;
	      			else if(l.Product_Group__c == 'Online') selectedRate = matchingCampaign.PsiGate_Online_Rate__c;	
	      		}
	      		
	      		for(Rate__c r : DBHelper.getRateListQuery()){
	      				if(r.Id==selectedRate) {
							l.Account_Setup_Fee__c = r.Account_Setup_Fee__c;
							l.Amex_JCB_Fee_del__c = r.Amex_JCB_Fee_del__c;
							l.Annual_Fee__c = r.Annual_Fee__c;
							l.Chargeback__c = r.Chargeback_del__c;
							l.Cross_Border_Fee__c = r.Cross_Border_Fee__c;
							l.Deconversion_Cancellation_Fee_per_loc__c = r.Deconversion_Cancellation_Fee_per_loc__c;
							l.Discover_Rate__c = r.Discover_Rate__c;
							l.Discover_Rate_Amount__c = r.Discover_Transaction_Fee__c;
							l.Interac_Fee__c = r.Interac_Fee__c;
							l.MC_VISA_Authorization__c = r.MC_VISA_Authorization__c;
							l.MasterCard_Cross_Border_Transaction_Fee__c = r.MasterCard_Cross_Border_Transaction_Fee__c;
							l.MasterCard_Rate__c = r.MasterCard_Rate__c;
							l.MasterCard_Rate_Amount__c = r.MasterCard_Transaction_Fee__c;
							l.Monthly_Account_Fee__c = r.Monthly_Account_Fee__c;
							l.Monthly_Minimums__c = r.Monthly_Minimums__c;
							l.Non_Qualifying_Surcharge_Fee__c = r.Non_Qualifying_Surcharge_Fee__c;
							l.Other_Monthly_Fees__c = r.Other_Monthly_Fees__c;
							l.VISA_Debit_Rate__c = r.VISA_Debit_Rate__c;
							l.VISA_Debit_Rate_Amount__c = r.VISA_Debit_Transaction_Fee__c;
							l.VISA_MasterCard_Card_Brand_Fee__c = r.VISA_MasterCard_Card_Brand_Fee__c;
							l.Visa_Rate__c = r.VISA_Rate__c;
							l.VISA_Rate_Amount__c = r.VISA_Transaction_Fee__c;
							l.Voice_Authorization__c = r.Voice_Authorization__c;
							l.Wireless_Terminal_Setup_Fee__c = r.Wireless_Terminal_Setup_Fee__c;
	      					break;
	      				}
	      		}
	        }
		}
		
		// add new campaign members
		try {
			insert newCMs;
		} catch (DmlException de) {
			// existing member...
		}
		
		// delete old campaign members
		List<CampaignMember> oldCMs = [SELECT id FROM CampaignMember WHERE key__c IN :delCMKeys];
		if (oldCMs.size() > 0) {
			delete oldCMs;
		}
	}

 

  • May 18, 2012
  • Like
  • 0

how can i implement the dynamic tree structure in visualforce page... can anyone pls help me out with some examples???i am struggling....

 

 

 

 

  • May 18, 2012
  • Like
  • 0

Hi,

 

I just wrote down the code below but have a hard time writing test coverage code. Can someone please write it or give me some ideas pointing me to the right direction. Thanks very much.

 

Trigger UpdateUpcoming on Task (after insert, after update)
{
    Set<id> AccountsIDs = new Set<id>();
    List<Account>AcctList = new List<Account>();
    For (task t:Trigger.new)
    {
    For (account at:[select id,upcoming_due__c,(select id,activitydate from tasks where isclosed = false and activitydate != null order by activitydate asc limit 1) from account where id =: t.accountid])
{
    If (date.valueof(t.activitydate) < at.upcoming_due__c || at.upcoming_due__c == null)
        at.upcoming_due__c = date.valueof(t.activitydate);
    If (trigger.isDelete)
        at.upcoming_due__c = null;
    AcctList.add(at);
}
}
    update AcctList;
}

Hi ,

 

we are looking for a login/registration functionality on sites. I know how to do it with customer portal but is there other way of doing this any guidlines will be helpfull.

 

http://wiki.developerforce.com/page/Authenticating_Users_on_Force.com_Sites

 

I know above i am looking for some other way to do it if any is available

 

i have sitation like this when i load a page.based on a condition like if the login email address is say a predefined value

it should go to two diffrent pages . How do i do this

Thanks in advance

Punnoose

Hi SF Team,

 

I've written an VF Page to enter the child object data of a Master Detail relationship for n rows

 

Is there a way to dynamically create a row after the last record is entered rather than specifying the no of rows beforehand.Would any attribute like onclick or on dbclick be helpful.

 

Below is the code.Please advice how to achieve it...

 

<apex:page controller="multiitemsInsert">
<apex:form >
<apex:sectionHeader title="POLINEITEMS" subtitle="AddPOITEMS" />
<apex:pageBlock title="Add row Dynamically" >
<apex:pageBlockButtons location="bottom">
<apex:commandButton value="Save" action="{!save_close}"/>
</apex:pageBlockButtons>
<Div align="right">
<apex:inputText value="{!num}"/>
<apex:commandButton value="Add rows" action="{!add_rows}"/>
</Div>
<br/>
<apex:pageBlockTable value="{!PLIC}" var="pli" id="table">
<apex:column headerValue="Inventory">
<apex:inputField value="{!pli.INV_Name__c}"/>
</apex:column>
<apex:column headerValue="Item">
<apex:inputField value="{!pli.ITEM__c}"/>
</apex:column>
<apex:column headerValue="Qty">
<apex:inputField value="{!pli.PO_Qty__c}"/>
</apex:column>
<apex:column headerValue="Unit Price">
<apex:inputField value="{!pli.Item_Unit_Price__c}"/>
</apex:column>
<apex:column headerValue="Line Value">
<apex:inputField value="{!pli.PO_LINE_VALUE_N__c}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>


AddrowController:-

 

public class multiitemsInsert {

{
public integer num { get; set; }
public List<PO_LINE_ITEM__c> PLIC {get; set;}
public multiitemsInsert()
{
PLIC = new List<PO_LINE_ITEM__c>();
PLIC.add(new PO_LINE_ITEM__c());
}
public PageReference add_rows() {
for(integer i=0;i<num ;i++)
{
PLIC.add(new PO_LINE_ITEM__c());
}

return null;
}
public PageReference save_close()
{ insert PLIC;
PageReference home = new PageReference('/a06/o');
home.setRedirect(true);
return home;
}
}

 

  • June 19, 2012
  • Like
  • 0

<p>i have one task like when i click checkbox i want display pick list in vf page</p>

Hello,

 

  1. on my PC (windows 7 & using IE8) I am having trouble when clicking on the Custom Button that opens a VF page – i have to log in again and then it opens the VF page.

 

However

 

2.  when I use another W7 & IE8 machine,  and logging in as  some User,  everything works ok, 

 

And

 

3. When using my W7 Machine, logging in as same user  but using firefox,  everything is ok.

 

 

My VF page has an action attribute calling a Method in Controller class as soon as it loads.

Also it use the DataTable and output panel to display the Lists populated in the Controller method.

I am not able to resolve this issue.

 

Can somebody plz help me.

 

Thanks i Advance

Regards

 

 

Hello,

i developed a VF page . in which when content of page is exceeded that a horizontal scroll bar is coming by native functionality of browser and page become much wide.

i dont want increase the width of the page. 

instead of this whenever content  of the page exceeded i want only scroll bar on my div which show the reslt not the scroll bar of browser and dont want that page would be wider than it was displayed on refreshed .

 

 

 

I've a visual force page that uses <apex:dataTable> component. The table is rendered fine when all the values of the columns are non empty. If the values in the columns are empty, the rendering is messed up on Firefox & IE. Chrome renders fine for empty column values too. Anybody had this issue before ?

 

 

  • June 06, 2012
  • Like
  • 0

Hi,

can any one help what is the attribute that i need to set for  displaying   two Pageblocktables in same pageblocksection side by side.

 

 

Thanks&Regards,

Veerendra

Hi,

 

I want  simple example  for integration......i.e., if my client updates the field in contact object...that field should updated in my salesforce edition...

 

Client belongs to third party...not a salesforce......

 

If,anyone knows about this reply me...immediately

  • June 06, 2012
  • Like
  • 0

Hi 

  I want to draw a bar an pie chart in visualforce page . I know It  can be by using GooglechartApi , But I want to draw by using 

  

  <apex:chart> .  I have treid alot . 

   here is my code . 

 

  

<apex:page controller="OppsController">
<apex:chart data="{!BarWedgeData}" width="600" height="400">
<apex:axis type="Category" position="left" fields="name" title="Opportunities"/>
<apex:axis type="Numeric" position="bottom" fields="amount" title="Amount"/>
<apex:barSeries orientation="horizontal" axis="bottom" xField="name" yField="amount"/>
<!--<apex:pieSeries dataField="amount" labelField="name"/>-->

</apex:chart>
<apex:dataTable value="{!BarWedgeData}" var="opp">
<apex:column headerValue="Opportunity" value="{!opp.name}"/>
<!--<apex:column headerValue="Amount" value="{!opp.amount}"/>-->
</apex:dataTable>
</apex:page>

 

 

My class code is 

 

 

public class OppsController {

// Get a set of Opportunities
public List<Opportunity> opptList{get;set;}

/* public ApexPages.StandardSetController setCon {
get {
if(setCon == null) {
setCon = new ApexPages.StandardSetController(Database.getQueryLocator(
[SELECT name, type, amount, closedate FROM Opportunity]));
setCon.setPageSize(5);
}
return setCon;
}
set;
}*/

List<BarWedgeData > data {get;set;}

public OppsController() {
opptList = [SELECT name, type, amount, closedate FROM Opportunity limit 10];
data = new List<BarWedgeData>();


}
public List<BarWedgeData > getBarWedgeData () {
for(Opportunity opt : opptList)
{
//data = new List<BarWedgeData>();
data.add(new BarWedgeData (opt.name));
}
//data.add(new BarWedgeData (opt.closedate));
return data;

}


public class BarWedgeData {

public String name { get; set; }
public Double data { get; set; }

public BarWedgeData (String name) {
this.name = name;
this.data = data;
}
}

}

 

here I have written code to dislaay all Opportunity name in a list and a graph.

  List is displayed but graph is not displayed. please help me as soon as possible

 

Thanks

asish

 

Hai,

 

 

How can I get a JSONString to a list?


String a=JSONString;

 

 

 

Hi,

 

i have a field called "err"  which of type 'String' in controller if its value is null then i have to display some message in visual force page. If it is not null than no message has to be displayed.

 

How can we do it. I tried but i am not getting.

 

<apex:pageMessage summary="{!Err}" severity="warning" rendered="IF(ISBLANK({!Err}),true,false)" id="errID" />

 

It is urgent.

 

Thanks,

Bujji

  • June 05, 2012
  • Like
  • 0

Hello,

         I am trying to use styles for my command buttons, but its not getting applied. The Code is as follows :

 

--- CSS style ---

<style type="text/css">
.styled-button-3 {
    -webkit-box-shadow: rgba(0, 0, 0, 0.0.97) 0px 1px 0px 0px;
    background-color: #5B74A8;
    border: 1px solid #29447E;
    font-family: 'Lucida Grande', Tahoma, Verdana, Arial, sans-serif;
    font-size: 12px;
    font-weight: bold;
    padding: 2px 6px;
    height: 20px;
    color: #fff;
    border-radius: 5px;
    background-image=none;
   
}
</style>

 

  --- commandbutton code ---

      <apex:pageBlock>

      <apex:pageBlockSectionItem>
      <apex:commandButton value="Refresh" action="{!showChart}" styleClass="styled-button-3"/>
       </apex:pageBlockSectionItem>

       </apex:pageBlock>

 

How can I make it work?

Hi There,

                  How can i display a table with 4 columns and 3 empty rows in a vf view page.

Anyone sugggest me how can i do that.

Hi,

 

Need to have a page where the inputText field must be activated only when the checkbox next to it is tagged.

Can you please provide me an example?

 

Thanks.

Hello,

 

ich have list in a VF Email template and I would like to know if it is possible to order the list.

It looks like this:

 

<messaging:emailTemplate subject="Subject" recipientType="Contact" relatedToType="Opportunity"> 

<messaging:attachment renderAs="PDF">

<apex:dataTable var="o" value="{!relatedTo.testObject__r}">
<apex:column headerClass="AngeboteTableHeader"  value="{!o.Field__c}"/>
</apex:dataTable>

 

I need to order the datatable by a specific field. is it possible?

 

Thanks in advance.

Hi ,

 

we are looking for a login/registration functionality on sites. I know how to do it with customer portal but is there other way of doing this any guidlines will be helpfull.

 

http://wiki.developerforce.com/page/Authenticating_Users_on_Force.com_Sites

 

I know above i am looking for some other way to do it if any is available

 

Hi All,

 

To read the GET parameters from the URL, we use:
ApexPages.currentPage().getParameters().get(<name>);

How can I read POST parameters from the URL ?

 

Thanks,
Pragati