• Bhaskar Chowdary
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 11
    Questions
  • 5
    Replies
Hello All,
I developed a system that genate PDF for 2 pages.
If data is sufficient to one page(no data for second page) my CSS is genarating second page by auto.
I dont want to see my second page.
How to I restrict that by using CSS.
@page
{}
.page
{}
I used above examples for genarating PDF and based on those CSS files my PDF is genarating.
I used this CSS in my  Component.


that CSS file stored in Static resource as a ZIP file and I am Accessing that in my component by using <apex:includeScript>


please assist ASAP.
for this we are stopped on going process.

@Bhaskar.

Hello every one I have a requirement like dont allo duplicate recoreds in my related list .

I created wrapper class that contains checkbox with selected questions

if select check box and click on button copy the selected questions to my related list that is lookup so here every time duplicated records also coming into that so how to restrict that by using apex please send any sample code to bhaskar.anumolu@gmail.com

 

Hi Buzzard please explain me why we use this 0 in date format

 

 

{0,date,yyyy-mm-dd}

 

 

Here please explain about ' 0 '

a

<apex:page controller="wrapperClassController2">   
<apex:form >       
<apex:pageBlock >           
<apex:pageBlockTable value="{!contacts}" var="c" id="table">               
<apex:column value="{!c.con.Name}" />               
<apex:column headerValue="Email">                 
<apex:outputField value="{!c.con.Email}" styleClass="c.style"/>            
</apex:column>               
<apex:column value="{!c.con.Phone}" />           
</apex:pageBlockTable>       
</apex:pageBlock>   
</apex:form>
</apex:page>

 

 

 

 

 

 

 

and the class is

 

public class wrapperClassController2 {   
//Our collection of the class/wrapper objects cContact    
public List<cContact> contactList {get; set;}       
//This method uses a simple SOQL query to return a List of Contacts  
 public List<cContact> getContacts(){       
 if(contactList == null){           
contactList = new List<cContact>();                   
for(Contact c : [select Id, Name, Email, Phone from Contact limit 10]){              
String style = getStyle(c);            
contactList.add(new cContact(c,style));          
}       
    }      
      return contactList;  
       }       
       public String getStyle(Contact con){    
       String style = 'green';    
       if(con.Email.contains('.com')){        
       style = 'red';     
       }               
       return style;   
       }      
       public class cContact{       
       public Contact con {get; set;}      
        public String style {get; set;}             
         public cContact(Contact c, String style){           
         this.con = c;          
          this.style = style;       
      }   
   }
}

 

i entered this in url

https://c.ap1.visual.force.com/apex/sendemail?i=0019000000ONI8K

 

 

Controller

public class sendEmail {
public String subject { get; set; }
public String body { get; set; }

private final Account account;

// Create a constructor that populates the Account object
public sendEmail() {

account = [SELECT Name, (SELECT Contact.Name, Contact.Email FROM Account.Contacts)
from Account where id = :ApexPages.currentPage().getParameters().get('id')];
}

public Account getAccount() {
return account;
}

public PageReference send() {
// Define the email
Messaging.SingleEmailMessage email = new Messaging.SingleEmailMessage();

String addresses;
if (account.Contacts[0].Email != null)
{
addresses = account.Contacts[0].Email;
// Loop through the whole list of contacts and their emails
for (Integer i = 1; i < account.Contacts.size(); i++)
{
if (account.Contacts[i].Email != null)
{
addresses += ':' + account.Contacts[i].Email;
}
}
}

String[] toAddresses = addresses.split(':', 0);

// Sets the paramaters of the email
email.setSubject( subject );
email.setToAddresses( toAddresses );
email.setPlainTextBody( body );

// Sends the email
Messaging.SendEmailResult [] r =
Messaging.sendEmail(new Messaging.SingleEmailMessage[] {email});

return null;
}
}

 

vf page is 

<apex:page controller="sendEmail">
<apex:messages />
<apex:pageBlock title="Send an Email to Your
{!account.name} Representatives">
<p>Fill out the fields below to test how you might send an email to a user.</p>
<br />
<apex:dataTable value="{!account.Contacts}" var="contact" border="1">
<apex:column >
<apex:facet name="header">Name</apex:facet>
{!contact.Name}
</apex:column>
<apex:column >
<apex:facet name="header">Email</apex:facet>
{!contact.Email}
</apex:column>
</apex:dataTable>

<apex:form >
<br /><br />
<apex:outputLabel value="Subject" for="Subject"/>:<br />
<apex:inputText value="{!subject}" id="Subject" maxlength="80"/>
<br /><br />
<apex:outputLabel value="Body" for="Body"/>:<br />
<apex:inputTextarea value="{!body}" id="Body" rows="10" cols="80"/>
<br /><br /><br />
<apex:commandButton value="Send Email" action="{!send}" />
</apex:form>
</apex:pageBlock>
</apex:page>

 

 

Error:System.QueryException: List has no rows for assignment to SObject 

 

 

System.QueryException: List has no rows for assignment to SObject 

 

 

 

please find out and give a code "I want to display 1.all cases opened  2. open opp records in visualforce page please give code for those "

 

controllee is

 

global class CompanyCasesQue {
public string FilterId{get;set;}
public list<case> results;
    //constructors and variable declaration

    public PageReference renderdiffview() {
    Map<Id,string> Id_status_map = new map<Id,string>{'00BW0000000PeSVMA0' => 'New','00BW0000000PeSGMA0' => 'Closed'};
    results = [select id,casenumber from case where status =: Id_status_map.get(filterId)];
     return null;
    }

    public List<Case> getresults() {      
     return results;
    }
    public List<SelectOption> getItems() {
        List<SelectOption> options = new List<SelectOption>();
        options.add(new SelectOption('00BW0000000PeSVMA0','View All Open Cases'));
        options.add(new SelectOption('00BW0000000PbzWMAS','View All Cases'));
        options.add(new SelectOption('00BW0000000PeSGMA0','View All Closed Cases'));
        options.add(new SelectOption('00B300000005XQtEAM','Recently Viewed Cases'));
        return options;
    }
}

 

page is

 

<apex:page controller="CompanyCasesQue" sidebar="true" showHeader="true">
    <apex:form >
        <apex:pageBlock title="Display the Cases ">
              <apex:outputLabel value="View:"/>
              <apex:selectList value="{!filterId}" size="1">
                <apex:actionSupport event="onchange" action="{!renderdiffview}" rerender="cases_table"/>
                <apex:selectOptions value="{!items}"/>
              </apex:selectList>
            <apex:pageBlock >
                <apex:pageBlockTable value="{!results}" var="c" rows="50" id="cases_table">
                    <apex:column >
                        <a target="_parent" href="/{!c.id}">{!c.CaseNumber}</a>
                        <apex:facet name="header">Case Number</apex:facet>
                    </apex:column>
                </apex:pageBlockTable>
            </apex:pageBlock>
        </apex:pageBlock>
    </apex:form>
</apex:page>

 

This is Bhaskar i am practicing SFDC i want to learn SFDC

 

How to use batch apex i am using this below code just copy and paste in apex classes page and runs it >  it did not save

Apex Class Edit  

 
Error: Compile Error: Invalid type: CustomAccountIterable at line 3 column 19

 

error is came please any send how to use batch apex when we use batch apex to my mail id

 

:: bhaskar.anumolu@gmail.com::

9652964411

 

 

global class batchClass implements Database.batchable{
   global Iterable start(Database.BatchableContext info){
       return new CustomAccountIterable();
   }     
   global void execute(Database.BatchableContext info, List<Account> scope){
       List<Account> accsToUpdate = new List<Account>();
       for(Account a : scope){
           a.Name = 'true';
           a.NumberOfEmployees = 70;
           accsToUpdate.add(a);
       }
       update accsToUpdate;
   }     
   global void finish(Database.BatchableContext info){     
   }
}

how to write case assignment rules to assign to queue

 

I want to insert a Imange like "logo.jpg "  at Header and alignment at "" center "" please send a cod for my visualforce page and that page render As PDF

 

send code to ""bhaskar.anumolu@gmail.com""

My App contains CTC field  and basic field

When i entered current CTC as 3,60,000

my Basic field is comming as 15000

 

 

formula is (Current CTC/12)*50%

 

Basic=((Current_CTC__c/12)*0.50)

 

 

how i write this code i dont want to caliculate by manul please reply to this

I Add one Contact immidiately trigger fire and automatically assign an account to that contact    please help us in this case "" code for write a trigger for add a account when u create an account ?""

Hi there,

 

I want to create a text file once my batch job is finished and save that file to c drive r any my documents filder.

 

can any one suggest me how to create text file or word file using apex class .

 

any idea ? any sample please.

How can I automatically assign incoming records to appropriate queue's

  • August 29, 2013
  • Like
  • 0

Hi all,

 

This is the first time I am using trigger on salesforce. So please explain in detail.

 

I have an custom object and there is a field called status (checkbox datatype). Whenever a record is created this field should be automatically change the status to open. 

 

Please explain how to write trigger for this.

 

Regards,

Manu

I Add one Contact immidiately trigger fire and automatically assign an account to that contact    please help us in this case "" code for write a trigger for add a account when u create an account ?""

Displaying Calendar on Visualforce page

  • April 24, 2012
  • Like
  • 0