• Guru 91
  • NEWBIE
  • 10 Points
  • Member since 2017
  • SFDC Consultant
  • Race2cloud

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 5
    Replies
Can any body please suggest how to write a test class for the below code, I am new to Test Class:-

public class QuotePDFController
   { 
   public QuotePDFController() 
    {

    }
    public String Total;
    public String DiscountTotal;
    public String Quote { get; set; }
    public String quoteId {get; set; } 
    public List<Quote> quoteList { get; set; }
    public List<ProductLineItem__c> productLineItems { get; set; }
    public Map<Id, List<ProductLineItem__c>> quotePLIMap { get; set; }
    Set<Id> quoteIds = new Set<Id>();
    Map<Id, Quote> qtMap = new Map<Id, Quote>();
    PRIVATE STATIC FINAL String ID = 'Id';
    
    public QuotePDFController(ApexPages.StandardController controller)
     {  
     quoteId = ApexPages.currentPage().getParameters().get(ID);
        quoteList = [SELECT Id,
                            Name,
                            CBG_PaymentTerms__c,
                            Opportunity.Name,
                            CBG_AllNetReceiptsMInclOption_No_Cur__c,
                            C4C_Date__c,
                            C4C_Date_of_Inquiry__c,
                            CreatedDate,
                            QuoteNumber,
                            CreatedBy.Name,
                            CreatedBy.MobilePhone,
                            CreatedBy.Fax,
                            CreatedBy.Email,
                            Opportunity.CBG_ValidTo__c,
                            Account.BillingCountry,
                            Account.BillingCity,
                            Account.BillingState,
                            Account.BillingPostalCode, 
                            (Select Name,
                                 CBG_Text__c,
                                 CBG_Title__c,
                                 CBG_SectionOnFrom__c 
                                 from  Quote_Texts__r)
                            FROM Quote where id =:quoteId ];
        quotePLIMap = new Map<Id, List<ProductLineItem__c>>();
        
        if(quoteList.size() > 0)
               {
                 for(Quote qt : quoteList)
                  {
                       quoteIds.add(qt.Id);
                       qtMap.put(qt.Id, qt);
                  }
            productLineItems = [SELECT Id,
                                       Name,
                                       CBG_Option__c,
                                       CBG_Quote_Incoterm__c,
                                       Product__r.Name,
                                       External_note__c,
                                       CBG_UnitofMeassure__c,
                                       CBG_Quantity__c,
                                       CBG_ItemLine__c,
                                       CBG_Incoterms__c,
                                       Item_Value_and_option__c,
                                       CBG_QuoteName__c, 
                                       CBG_Product_and_External_Note__c,
                                       CGB_Quantity_and_Measure__c,
                                       Edge_Types__c,CBG_Price__c,
                                       CBG_AdjustedItemValue__c,
                                       CBG_AdjustedItemPrice__c,
                                       (SELECT Name,
                                               test_quantity__c,
                                               CBG_Incoterms__c,
                                               Feight_Percent_Total__c,
                                               CBG_IncotermLocation__c,
                                               CBG_SpecialFreightDummy_Cur__c,
                                               CBG_SpecialFreightDummy_Per__c,
                                               CBG_ProductLineItem__r.name 
                                               FROM Special_Freight__r)
                                       FROM ProductLineItem__c WHERE CBG_QuoteName__c =:quoteId];
                                       
            system.debug('PLI List is ' + productLineItems);
            
        }
       
      
    } 
    
    
}
Hi all,
I have a requirement, Update Oypportunity Stage when quote send to customer through mail.
I achived through Trigger on Task.
Is it possible to do with process builder.

regards 
Guru 
Hello Everyone,
I created Onclick java script button in quote to update quote version.
{!REQUIRESCRIPT("/soap/ajax/31.0/connection.js")} 

//declare the varaiable that will hold all the information 
var newRecords = []; 

var opp = new sforce.SObject("Quote"); 
opp.Id = '{!Quote.Id}'; 
opp.CBG_Check_to_Quote_Version__c = '1';
opp.CBG_Check_to_Version__c = '1';

if (confirm("Do you want to revise Quote?") == true)
 {
opp.CBG_Check_to_Quote_Version__c = '1';   
 txt = "You pressed OK!";
 
}

else 
{
opp.CBG_Check_to_Quote_Version__c = '0';
opp.CBG_Quote_Version__c = "  ";
txt = "You pressed Cancel!";



result = sforce.connection.update([opp]); 
window.location.reload(); 
opp.CBG_Check_to_Quote_Version__c = '0'; 
newRecords.push(opp); 
result = sforce.connection.update([opp]); 
window.location.reload();


This button is only visible if opportunity Brand = textile(Opportunity field).
so i created two separate record types with deferent page layout.
Now i created workflow to change record type.
Up to now working  well like whenever opportunity Brand = Phoenix and when i create New quote. I am able to see button in Quote detail page.
  User-added image            User-added image                               
Now if change opportunity Brannd = non Phoenix and if i update existing quote. I should not see the button button over there but button is there.---It is not working.

User-added image
User-added image

Please help me how to do it.
Hello Every One,
I have a class for Searching a record in quote and i written test class for that and it is fail. 
Can you please help me with that 
Apex Class:

public with sharing class accsearchcontroller 
{

    public accsearchcontroller(ApexPages.StandardController controller) {

    }


    public String l { get; set; }
public list <quote> acc {get;set;}
public string searchstring {get;set;}
public String quoteid{get; set;}
public Boolean search{get; set;}
public Boolean result{get; set;}
public accsearchcontroller( ) 
{
}
public void search(){
string searchquery='select QuoteNumber,Name,Email,Opportunity.Name,CBG_SAPQuoteNumber__c  from quote where CBG_SAPQuoteNumber__c like \'%'+searchstring+'%\' OR CBG_SAPQuoteNumber__c like \'*'+searchstring+'*\'  Limit 20';
acc= Database.query(searchquery);
}
public void clear(){
acc.clear();

}
public PageReference processLinkClick() {
         
        search = false;
        result = false;
        //Pagereference p1 = new PageReference('https://ap7.salesforce.com/'+quoteid);
        Pagereference p1 = new PageReference('https://cs84.salesforce.com/'+quoteid);
        p1.setRedirect(true);
        return p1;
    }
}
Hi,
I have written visual email templates and I want to display logo but it is not showing logo.

Here my Template:

<messaging:emailTemplate subject="Regarding Student" recipientType="Contact" relatedToType="user">
<messaging:plainTextEmailBody >

{!RelatedTo.FirstName} {!RelatedTo.LastName} 
_____________________________________________
Continental 
Division  {!RelatedTo.Division__c}
Segment   {!RelatedTo.Segment__c}
Rechnungsanschrift/Billing address {!RelatedTo.Billing_Address__c}
Mobile            {!RelatedTo.MobilePhone}
Email             {!RelatedTo.Email}  
Visit us @        {!RelatedTo.URL__c}
______________________________________________

http://www.continental-corporation.com  

<img src="https://testguru--test1--c.cs50.visual.force.com/resource/1509087818000/Contitechtest" 
    width="200" height="200"/> 

</messaging:plainTextEmailBody>
</messaging:emailTemplate>


Here is Preview:

Guru 
_____________________________________________
Continental 
Division  
Segment   IT
Rechnungsanschrift/Billing address Jeevan Bhema Nagar
Mobile            (709) 708-5320
Email             vguru@race2cloud.com  
Visit us @        www. race2cloud.com
______________________________________________

http://www.continental-corporation.com  

<img height="200" src="https://testguru--test1--c.cs50.visual.force.com/resource/1509087818000/Contitechtest" width="200" />
Hi,
I want to search record in object level. So I written VF and I am able to Seach record in object level.Now i want to place that VF  beside List View in contact object. how can i do it.

Thank you
Hello Everyone,
I created Onclick java script button in quote to update quote version.
{!REQUIRESCRIPT("/soap/ajax/31.0/connection.js")} 

//declare the varaiable that will hold all the information 
var newRecords = []; 

var opp = new sforce.SObject("Quote"); 
opp.Id = '{!Quote.Id}'; 
opp.CBG_Check_to_Quote_Version__c = '1';
opp.CBG_Check_to_Version__c = '1';

if (confirm("Do you want to revise Quote?") == true)
 {
opp.CBG_Check_to_Quote_Version__c = '1';   
 txt = "You pressed OK!";
 
}

else 
{
opp.CBG_Check_to_Quote_Version__c = '0';
opp.CBG_Quote_Version__c = "  ";
txt = "You pressed Cancel!";



result = sforce.connection.update([opp]); 
window.location.reload(); 
opp.CBG_Check_to_Quote_Version__c = '0'; 
newRecords.push(opp); 
result = sforce.connection.update([opp]); 
window.location.reload();


This button is only visible if opportunity Brand = textile(Opportunity field).
so i created two separate record types with deferent page layout.
Now i created workflow to change record type.
Up to now working  well like whenever opportunity Brand = Phoenix and when i create New quote. I am able to see button in Quote detail page.
  User-added image            User-added image                               
Now if change opportunity Brannd = non Phoenix and if i update existing quote. I should not see the button button over there but button is there.---It is not working.

User-added image
User-added image

Please help me how to do it.
Hello Everyone,
I created Onclick java script button in quote to update quote version.
{!REQUIRESCRIPT("/soap/ajax/31.0/connection.js")} 

//declare the varaiable that will hold all the information 
var newRecords = []; 

var opp = new sforce.SObject("Quote"); 
opp.Id = '{!Quote.Id}'; 
opp.CBG_Check_to_Quote_Version__c = '1';
opp.CBG_Check_to_Version__c = '1';

if (confirm("Do you want to revise Quote?") == true)
 {
opp.CBG_Check_to_Quote_Version__c = '1';   
 txt = "You pressed OK!";
 
}

else 
{
opp.CBG_Check_to_Quote_Version__c = '0';
opp.CBG_Quote_Version__c = "  ";
txt = "You pressed Cancel!";



result = sforce.connection.update([opp]); 
window.location.reload(); 
opp.CBG_Check_to_Quote_Version__c = '0'; 
newRecords.push(opp); 
result = sforce.connection.update([opp]); 
window.location.reload();


This button is only visible if opportunity Brand = textile(Opportunity field).
so i created two separate record types with deferent page layout.
Now i created workflow to change record type.
Up to now working  well like whenever opportunity Brand = Phoenix and when i create New quote. I am able to see button in Quote detail page.
  User-added image            User-added image                               
Now if change opportunity Brannd = non Phoenix and if i update existing quote. I should not see the button button over there but button is there.---It is not working.

User-added image
User-added image

Please help me how to do it.
Hello Every One,
I have a class for Searching a record in quote and i written test class for that and it is fail. 
Can you please help me with that 
Apex Class:

public with sharing class accsearchcontroller 
{

    public accsearchcontroller(ApexPages.StandardController controller) {

    }


    public String l { get; set; }
public list <quote> acc {get;set;}
public string searchstring {get;set;}
public String quoteid{get; set;}
public Boolean search{get; set;}
public Boolean result{get; set;}
public accsearchcontroller( ) 
{
}
public void search(){
string searchquery='select QuoteNumber,Name,Email,Opportunity.Name,CBG_SAPQuoteNumber__c  from quote where CBG_SAPQuoteNumber__c like \'%'+searchstring+'%\' OR CBG_SAPQuoteNumber__c like \'*'+searchstring+'*\'  Limit 20';
acc= Database.query(searchquery);
}
public void clear(){
acc.clear();

}
public PageReference processLinkClick() {
         
        search = false;
        result = false;
        //Pagereference p1 = new PageReference('https://ap7.salesforce.com/'+quoteid);
        Pagereference p1 = new PageReference('https://cs84.salesforce.com/'+quoteid);
        p1.setRedirect(true);
        return p1;
    }
}