• salesforcelearner1
  • NEWBIE
  • 5 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 24
    Questions
  • 26
    Replies
Hi All,

I have created invocable method to display recommendations on the home page of the application. when user clicks on the button it should take me to the particular record detail page. how to pass recordid to the lightning flow to get redirect it to detail page. Can any one help me.

Thanks in advance.....
Hi,

I have seen some objects API Name ends with __KAV. What are they. how to create them. 

Thanks in advance...
 
I have Included a visualforce page in communities. I'm displaying custom object's records in it. I have given permission to page, object and fields for profile that loggedIn. But still it doesn't display me anything. When i check debug logs zero rows are retrieved from the that object. But when I loggedIn as system administrator I was get the records.

Please guide me to solve this issue.

Regards,
SalesforceLearner.
HI All,

I have override the new button with lightning component. when I click new button from Parent Related list, I want to prepopulate the parentid in the custom component for this I want to get ParentId. I tried isurl addressable I'm able to get parentid, but its not working in the SF1. Is their any other work around.

Thanks in advance
 
I have overrided the New button with lightning component. It is working fine in desktop view. In SF1 the New button still redirect me Standard page layout. I have already checked mobile override.
Hi All,

I have a canvas image in the visualforce page. I have coordinates to mark on the image. I would like to pass coordinates through java script / jquery to mark on the image. I have already implemented onclick to mark on the image, but i want to pass those coordinates without onclick. please guide me.

Thanks,
Salesforcelearner.
 
Hello All,

I have created custom metadata type and records, added it to the managed package.  Now I want to add another record of  custom metadata type to managed package.  When i click add to components before uploading managed package.  I didn't find newly created record of custom metadata type. Can anyone guide me please.

Thanks,
Salesforcelearner
Hi,
I'm Uploading managed package which gives me this error "permission set references custom object thas has M-D realtionship with Standard object". My upload fails. Can anyone tell me the workaround for this error. Master object is standard object and detail object is custom object. I have a permission set in managed package custom objects has permission in it.

Thanks,
Elearner.
Hi Team,

I'm displaying some fields on visualforce page using Field sets. In that I have multipicklist displaying like below. how to fix it.
User-added image
Hi,
I have included jquery from static resource in the lightning component. When I open the page it gives me [SecureDOMEvent: [object Event]{ key: {"namespace":"xxxxxxx"} }] error.  How to solve it, please help me out
Hi Team,

How to remove namespace from the host url in the installed org. because I want to create a visualforce page from the managed pacakge apex class
HI team,

I have a requirement to create a visualforce page after installing managed package in the Installed org. Can I do it using postinstall script?.
Hi All,

I'm trying to make a rest api callout from salesforce to magento it returns Invalid signature. If any one has implemented this integration before please guide me. I have got the response when their is no filtercriteria.
Hi All,

I'm trying to Integrate salesforce with magento. Can someone give me the sample code to connect with magento from salesforce.

Thanks
I have submitted my app to security review. I got " Password Echo" Issue.I wrote visualforce page to accept user name and password.These fields are stored in protected custom settings. I tried to solve it by changing  the inputfield to inputsecret, the characters are hided but security review is failed.
Failure resonponse
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Header>
      <h:ResponseContext xmlns:h="http://purolator.com/pws/datatypes/v2" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
         <h:ResponseReference>ff787f7e-351e-49fb-b029-6dc2d835dc5b</h:ResponseReference>
      </h:ResponseContext>
   </s:Header>
   <s:Body>
      <GetFullEstimateResponse xmlns="http://purolator.com/pws/datatypes/v2" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
         <ResponseInformation>
            <Errors>
               <Error>
                  <Code>3001149</Code>
                  <Description>Invalid sender postal code specified. Postal Code does not match any of the registered Postal Codes associated with the supplied Key.</Description>
                  <AdditionalInformation i:nil="true"/>
               </Error>
            </Errors>
            <InformationalMessages i:nil="true"/>
         </ResponseInformation>
         <ShipmentEstimates i:nil="true"/>
         <ReturnShipmentEstimates i:nil="true"/>
      </GetFullEstimateResponse>
   </s:Body>
</s:Envelope>
Success Response:-
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Header>
      <h:ResponseContext xmlns:h="http://purolator.com/pws/datatypes/v2" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
         <h:ResponseReference>ae3ec807-6442-4581-848c-bbd6af200a48</h:ResponseReference>
      </h:ResponseContext>
   </s:Header>
   <s:Body>
      <GetFullEstimateResponse xmlns="http://purolator.com/pws/datatypes/v2" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
         <ResponseInformation>
            <Errors/>
            <InformationalMessages i:nil="true"/>
         </ResponseInformation>
         <ShipmentEstimates>
            <ShipmentEstimate>
               <ServiceID>PurolatorExpress9AM</ServiceID>
               <ShipmentDate>2018-07-17</ShipmentDate>
               <ExpectedDeliveryDate>2018-07-18</ExpectedDeliveryDate>
               <EstimatedTransitDays>1</EstimatedTransitDays>
               <BasePrice>199.69</BasePrice>
               <Surcharges>
                  <Surcharge>
                     <Amount>30.4</Amount>
                     <Type>Fuel</Type>
                     <Description>Fuel</Description>
                  </Surcharge>
                  <Surcharge>
                     <Amount>2.95</Amount>
                     <Type>ResidentialDelivery</Type>
                     <Description>Residential Area</Description>
                  </Surcharge>
               </Surcharges>
               <Taxes>
                  <Tax>
                     <Amount>0</Amount>
                     <Type>PSTQST</Type>
                     <Description>PST/QST</Description>
                  </Tax>
                  <Tax>
                     <Amount>0</Amount>
                     <Type>HST</Type>
                     <Description>HST</Description>
                  </Tax>
                  <Tax>
                     <Amount>11.65</Amount>
                     <Type>GST</Type>
                     <Description>GST</Description>
                  </Tax>
               </Taxes>
               <OptionPrices i:nil="true"/>
               <TotalPrice>244.69</TotalPrice>
            </ShipmentEstimate>
            <ReturnShipmentEstimates i:nil="true"/>
      </GetFullEstimateResponse>
   </s:Body>
</s:Envelope>
How to parse this using dom. i'm pretty new to xml please help me
HI All,

I have submitted my application for security review. "Your submission did not include web application scan results for the external endpoints integrated with your app". I have downloaded the software burp to achieve this task but I couldn't able to generate report. Can someone guide me.

Thanks in advance !!.
Hi,
I'm trying to display bar graph in visualforce page. but it is displaying like this below,

User-added image
  Data is being shifted to left for first one and shifted to right for last one. how to set them exactly
Hi,

I like to integrate salesforce and woocommerce. Does any one implemented it before i would like to know how to achieve this task. I dont want to use 3rd party Apps for it.
I'm new to lightning component. How to refer SVG in my lightning component
Test Class :-

@IsTest
public class OpportunityHandlerTest 
{
   //public static String VAR_EXP = '0 0 0 15 3 ? 2022'; 
   
   private static testmethod void MyUnitTest()
   {  
       Integer MAX_QUERY = Limits.getLimitQueries();
       Integer NUM_QUERY = MAX_QUERY - 1; 
      //Create accunt
      Account acc = new account();
      acc.name='test';
      try
      {
          insert acc;
          system.debug('this is acc' +acc); 
      }
      catch(DMLException de)
      {
           system.debug('a is failed' +de.getMessage());
      }
      
       //Create contact 1
       Contact c=new Contact();
       c.lastname='nunes';
       c.Accountid=acc.id;
       c.LeadSource='Inbound';
       c.Contact_Status__c='Open';
       c.New_Lead_Source__c='Inbound';
       c.Pre_Demo_Notes__c='from pre contact';
       c.Post_Demo_Notes__c='from post contact';
       c.Created_in_admin_panel__c=true;
       insert c;
       system.assert(c.id != null);
       
       //Create contact 2
       Contact c2=new Contact();
       c2.lastname='nunes';
       c2.Accountid=acc.id;
       c2.LeadSource='Inbound';
       c2.Contact_Status__c='Open';
       c2.New_Lead_Source__c='Inbound';
       c2.Pre_Demo_Notes__c='from pre contact';
       c2.Post_Demo_Notes__c='from post contact';
       c2.Created_in_admin_panel__c=true;
       insert c2;
       system.assert(c2.id != null);
       
       
        Opportunity opp1 = new Opportunity(AccountId=acc.id,Upsell_Potential__c='No', Name='o2',contact_name__c=c.id, CloseDate=System.today(), StageName='Prospecting',Product_Specialist__c='Nicolas Carreras');
        insert opp1;

        Opportunity opp=[Select id,Contact_Name__c from Opportunity where contact_name__c != null ];
        opp.name='Start';
        opp.Contact_Name__c=c2.id;
        update opp;

        Opportunity opp2 = new Opportunity(AccountId=acc.id,Upsell_Potential__c='No', Name='o2', CloseDate=System.today(), StageName='Prospecting',Product_Specialist__c='Nicolas Carreras');
        insert opp2;

        Opportunity opp3 = new Opportunity
        (AccountId=acc.id,
        Upsell_Potential__c='SDR Target', 
        Name='o3', 
        CloseDate=System.today(), 
        StageName='Closed Won',
        Product_Specialist__c='Nicolas Carreras',
        Catalyst__c='Greenfield'
        //RenewalDate__c=system.today()
        );
        insert opp3;
        
        opp3.StageName = 'Prospecting';
        update opp3;
        
        opp3.StageName = 'Closed Won';
        update opp3; 
        
         OpportunityContactRole opcr=new OpportunityContactRole();
         opcr.OpportunityId = opp3.id;
         opcr.ContactId = c2.id;
         opcr.IsPrimary = true;
         opcr.Role='End-User';
         insert opcr;
        system.assert(opcr.id != null); 
        
        Id stdpricebook = System.Test.getStandardPricebookId();
        system.debug('this is stdpricebook : ' +stdpricebook);
        system.assert(stdpricebook != null);
        
        List<SBQQ__Quote__c> qlist=new List<SBQQ__Quote__c>();
        SBQQ__Quote__c thisquote=new SBQQ__Quote__c();
        thisquote.SBQQ__SubscriptionTerm__c=12;
        thisquote.SBQQ__StartDate__c=system.today();
        thisquote.SBQQ__PriceBook__c=stdpricebook;
        thisquote.SBQQ__Primary__c=true;
        thisquote.SBQQ__Opportunity2__c=opp3.id;
        qlist.add(thisquote);
        //try{
        Test.startTest();
        insert qlist;
        Test.stopTest();
        //}
        ////catch(exception e)
        //{
        //system.debug(e);
        //}
        System.assert(thisquote.id != null);
        
        set<id> setid = new set<id>();
        
        for(SBQQ__Quote__c a : qlist){
        
        setid.add(a.id);
        }
        
       // list<SBQQ__Quote__c> insrtdQ = 
        list<SBQQ__QuoteLine__c> qq = [select id from SBQQ__QuoteLine__c where id=:setid];
        List<SBQQ__QuoteLine__c> newQlils = new List<SBQQ__QuoteLine__c>();   
          
       for(SBQQ__QuoteLine__c qq1 :qq ){
       
       if(qq1.id != null){
       SBQQ__QuoteLine__c QL = new SBQQ__QuoteLine__c();
     //  QL.SBQQ__Quote__c = setid;
       
       }
       }
       
     }  
                 
}

Apex Class:-

public class OpportunityHandler_cpq{

public integer enddate;

    Public void CpqQuoteInsert( list<opportunity> listopp){
        
        set<id> oppids = new set<id>();
      
        for(opportunity op :listopp ) {
      
            if(op.SBQQ__Renewal__c == True &&  op.SBQQ__RenewedContract__c != null ){

              oppids.add(op.id);
              system.debug('First op id'+op.id);
            }
        }
        system.debug('oppids::'+oppids);  
        List<Opportunity> oppls = [select id,Renewal_Contract_Term__c,SBQQ__RenewedContract__c, formulapreviousopp__c, SBQQ__RenewedContract__r.SBQQ__Opportunity__c from opportunity where id IN : oppids];
        system.debug('oppls::'+oppls);  
        Map<Id, Id> oldVSnewOpp = new Map<Id, Id>();
   
        for(Opportunity opp: oppls) {
            system.debug('opp.SBQQ__RenewedContract__c::'+opp.SBQQ__RenewedContract__c);
            system.debug('opp.SBQQ__RenewedContract__r.SBQQ__Opportunity__c::'+opp.SBQQ__RenewedContract__r.SBQQ__Opportunity__c);
            system.debug('opp.formulapreviousopp__::'+opp.formulapreviousopp__c);
            
            if(opp.SBQQ__RenewedContract__c != null && opp.SBQQ__RenewedContract__r.SBQQ__Opportunity__c != null)
                oldVSnewOpp.put(opp.SBQQ__RenewedContract__r.SBQQ__Opportunity__c, opp.Id);
     
        }
        system.debug('oldVSnewOpp:'+oldVSnewOpp);
        List<Opportunity> oldOppls = [select id, name,
                                                (Select ACV_Auto_Renew_Increment_Amount__c, ACV__c, Account_Name__c, Auto_Renew__c, Contract_End_Date__c, CreatedById, CreatedDate, Document_Template__c, 
Id, IsDeleted, LastActivityDate, LastModifiedById, LastModifiedDate, LastReferencedDate, LastViewedDate, Name, Number_of_Licences__c, 
Opp_Closed__c, Original_Quote_id__c, OwnerId, Payment__c, Primary_Contact_First_Name__c, Product_Family__c, SBQQ__Account__c, 
SBQQ__AdditionalDiscountAmount__c, SBQQ__AverageCustomerDiscount__c, SBQQ__AveragePartnerDiscount__c, SBQQ__BillingCity__c, SBQQ__BillingCountry__c, 
SBQQ__BillingFrequency__c, SBQQ__BillingName__c, SBQQ__BillingPostalCode__c, SBQQ__BillingState__c, SBQQ__BillingStreet__c, SBQQ__ContractingMethod__c,
 SBQQ__CustomerAmount__c, SBQQ__CustomerDiscount__c, SBQQ__DaysQuoteOpen__c, SBQQ__DefaultTemplate__c, SBQQ__DeliveryMethod__c, SBQQ__DistributorDiscount__c,
 SBQQ__Distributor__c, SBQQ__DocumentStatus__c, SBQQ__EmailTemplateId__c, SBQQ__EndDate__c, SBQQ__ExpirationDate__c, SBQQ__FirstSegmentTermEndDate__c,
 SBQQ__GenerateContractedPrice__c, SBQQ__Introduction__c, SBQQ__Key__c, SBQQ__LineItemCount__c, SBQQ__LineItemsGrouped__c, SBQQ__LineItemsPrinted__c, 
 SBQQ__ListAmount__c, SBQQ__MarkupRate__c, SBQQ__MasterContract__c, SBQQ__NetAmount__c, SBQQ__Notes__c, SBQQ__Opportunity2__c, SBQQ__Ordered__c, 
 SBQQ__OriginalQuote__c, SBQQ__PartnerDiscount__c, SBQQ__Partner__c, SBQQ__PaymentTerms__c, SBQQ__PriceBook__c, SBQQ__PricebookId__c,
 SBQQ__PrimaryContact__c, SBQQ__Primary__c, SBQQ__QuoteProcessId__c, SBQQ__QuoteTemplateId__c, SBQQ__RegularAmount__c, SBQQ__SalesRep__c, 
 SBQQ__ShippingCity__c, SBQQ__ShippingCountry__c, SBQQ__ShippingName__c, SBQQ__ShippingPostalCode__c, SBQQ__ShippingState__c, SBQQ__ShippingStreet__c, 
 SBQQ__Source__c, SBQQ__StartDate__c, SBQQ__Status__c, SBQQ__SubscriptionTerm__c, SBQQ__TargetCustomerAmount__c, SBQQ__TotalCustomerDiscountAmount__c,
 SBQQ__Type__c, SBQQ__WatermarkShown__c, SystemModstamp
                                                from SBQQ__Quotes2__r where SBQQ__Primary__c =  true) 
                                    from opportunity where id IN :oldVSnewOpp.keySet()];
         system.debug('oldOppls:'+oldOppls);
     
        List<SBQQ__Quote__c>  quotels = new  List<SBQQ__Quote__c>();
        for(Opportunity oldOpp :oldOppls) {
            if(oldOpp.SBQQ__Quotes2__r.size() >0 ) {
                system.debug('oldOpp.SBQQ__Quotes2__r::'+oldOpp.SBQQ__Quotes2__r);
                system.debug('oldVSnewOpp.containsKey(oldOpp.id)::'+oldVSnewOpp.containsKey(oldOpp.id));
                if(oldVSnewOpp.containsKey(oldOpp.id)) {
                    system.debug('here!!!!!!');
                    SBQQ__Quote__c  quote1 =  oldOpp.SBQQ__Quotes2__r[0].clone();
                    quote1.Original_Quote_id__c=oldOpp.SBQQ__Quotes2__r[0].id;
                    quote1.SBQQ__StartDate__c = system.today();
                    
                 //  Integer enddate= Integer.valueOf(String.valueOf(Math.roundToLong(oldOpp.SBQQ__Quotes2__r[0].SBQQ__SubscriptionTerm__c)));
                    
              //   quote1.SBQQ__EndDate__c =system.today().addmonths(enddate);

                    system.debug('quote1.Original_Quote_id__c::'+quote1.Original_Quote_id__c);
                    quote1.SBQQ__Opportunity2__c = oldVSnewOpp.get(oldOpp.id);
                    system.debug('quote1::'+quote1);
                    quotels.add(quote1);
                } 
         
            }
     
        }
        system.debug('quotels::'+quotels);
        
        if(quotels.size()>0) {
            insert quotels;
        }
        
       
        
         set<id> Quoteid = new set<id>();
         Map<id, id> oldQuoteVSNewQuoteIds = new Map<id, id>();
         for(SBQQ__Quote__c qt : quotels){
            if(qt.Original_Quote_id__c != null){
                oldQuoteVSNewQuoteIds.put(qt.Original_Quote_id__c, qt.id);
            }
        }
        system.debug('oldQuoteVSNewQuoteIds:::'+oldQuoteVSNewQuoteIds);
        
        list<SBQQ__Quote__c> oldquotelist = [Select ACV_Auto_Renew_Increment_Amount__c, ACV__c, Account_Name__c, Auto_Renew__c, Contract_End_Date__c, CreatedById, CreatedDate, Document_Template__c, 
Id, IsDeleted, LastActivityDate, LastModifiedById, LastModifiedDate, LastReferencedDate, LastViewedDate, Name, Number_of_Licences__c, 
Opp_Closed__c, Original_Quote_id__c, OwnerId, Payment__c, Primary_Contact_First_Name__c, Product_Family__c, SBQQ__Account__c, 
SBQQ__AdditionalDiscountAmount__c, SBQQ__AverageCustomerDiscount__c, SBQQ__AveragePartnerDiscount__c, SBQQ__BillingCity__c, SBQQ__BillingCountry__c, 
tartDate__c, SBQQ__Status__c, SBQQ__SubscriptionTerm__c, SBQQ__TargetCustomerAmount__c, SBQQ__TotalCustomerDiscountAmount__c,
 SBQQ__Type__c, SBQQ__WatermarkShown__c, SystemModstamp,
                                              (Select CreatedById, CreatedDate, Id, IsDeleted, LastModifiedById, LastModifiedDate, Name, Opportunity__c, Product_Description__c, Product_Family__c, 
SBQQ__AdditionalDiscountAmount__c, SBQQ__AdditionalDiscount__c, SBQQ__AdditionalQuantity__c, SBQQ__AllowAssetRefund__c, SBQQ__BatchQuantity__c, 
SBQQ__BillingFrequency__c, SBQQ__BillingType__c, SBQQ__BlockPrice__c, SBQQ__Bundle__c, SBQQ__BundledQuantity__c, SBQQ__Bundled__c, SBQQ__CarryoverLine__c,
 SBQQ__ChargeType__c, SBQQ__ComponentCost__c, SBQQ__ComponentDiscountedByPackage__c, SBQQ__ComponentListTotal__c, SBQQ__ComponentSubscriptionScope__c, 
 
 
 SBQQ__TotalDiscountRate__c, SBQQ__UnitCost__c, SBQQ__UnproratedNetPrice__c, SBQQ__UpgradedAsset__c, SBQQ__UpgradedQuantity__c, 
 SBQQ__UpgradedSubscription__c, SBQQ__UpliftAmount__c, SBQQ__Uplift__c, SBQQ__VolumeDiscount__c, SystemModstamp  FROM SBQQ__Lineitems__r) FROM SBQQ__Quote__c 
                                                   where id IN :oldQuoteVSNewQuoteIds.keySet()];
                                              
        List<SBQQ__QuoteLine__c> newQlils = new List<SBQQ__QuoteLine__c>();                                           
        for(SBQQ__Quote__c q1 :oldquotelist){
            for(SBQQ__QuoteLine__c qli : q1.SBQQ__Lineitems__r){
                SBQQ__QuoteLine__c newQli = qli.clone();
                newQli.SBQQ__Quote__c = oldQuoteVSNewQuoteIds.get(q1.id);
                newQli.SBQQ__Product__c= qli.SBQQ__Product__c;
                
                system.debug('qli:::'+qli.SBQQ__ProductFamily__c+ '::'+qli);
                system.debug('newQli:::'+newQli.SBQQ__ProductFamily__c+ '::'+newQli);

                newQlils.add(newQli);  
            } 
        }
        
        system.debug('newQlils::'+newQlils.size() + '::' +newQlils);
        if(newQlils.size() > 0) {
            insert newQlils;
        
        }
      /*  set<Id> newIds = new Set<Id>();
        for(SBQQ__QuoteLine__c qliNew1 :newQlils) {
            newIds.add(qliNew1.id);
        }
        
    
    List<SBQQ__QuoteLine__c>  updatedValue = [select id, name, SBQQ__CustomerPrice__c,SBQQ__ProductFamily__c  from SBQQ__QuoteLine__c where id IN :newIds];                                      
    system.debug('updatedValue::'+updatedValue);
    for(SBQQ__QuoteLine__c a1  :updatedValue) {
        system.debug('a1::'+a1);
    
    }
        */
        
        set<id> newQuoteid = new set<id>();
       
       for(SBQQ__Quote__c qt2 :quotels){
       newQuoteid.add(qt2.id);
       
       }
       
     //  list<string> updateTerm = new list<string>();
        
        list<SBQQ__Quote__c> newQuote =[select SBQQ__SubscriptionTerm__c, Renewal_Contract_Term_from_Renewal_opp__c, SBQQ__EndDate__c from  SBQQ__Quote__c where id=:newQuoteid];

        for(SBQQ__Quote__c updateEnddate: newQuote){
        
           Integer enddate= Integer.valueOf(String.valueOf(Math.roundToLong(updateEnddate.Renewal_Contract_Term_from_Renewal_opp__c)));

        
        updateEnddate.SBQQ__EndDate__c = system.today().addMonths(enddate);
        
        updateEnddate.SBQQ__SubscriptionTerm__c =updateEnddate.Renewal_Contract_Term_from_Renewal_opp__c;
        
        update updateEnddate;
        }

    } 
        
}
  • June 18, 2019
  • Like
  • 1
This is my Apex class

public class ExportEmailMessageDataController {
    Public Static List<Case> documents{get;set;}
    Public Static List<EmailMessage> Doc{get;set;}
    public ExportEmailMessageDataController(ApexPages.StandardSetController controller){
    }
    public Static Void getEmailMessage(){
        documents = [SELECT Id, (SELECT Id, ParentId, TextBody, Headers, Subject, FromName, FromAddress, ToAddress, BccAddress,CcAddress, Incoming, HasAttachment, Status FROM EmailMessages)From Case Where Status = 'Closed'];
        // List<EmailMessage> em =[SELECT LastModifiedDate, Id, Subject,ParentId FROM EmailMessage where LastModifiedDate <= LAST_N_DAYS:30 ];
        system.debug('documents'+documents);
        String replaceBr = '';
        Doc = new List<EmailMessage>();
        for(Case c : documents){
            system.debug('c.EmailMessages'+c.EmailMessages);
            if(c.EmailMessages!=null){
                system.debug('In email message');
                for(EmailMessage em : c.EmailMessages){
                    system.debug('check email message');
                      if( em.TextBody != NULL)
                    { 
                        em.TextBody = em.TextBody.replace('\r\n', ' ');
                        em.TextBody = em.TextBody.replace('\n', ' ');
                        em.TextBody = em.TextBody.replace('\r', ' ');
                    }
                    
                    Doc.add(em);
                }
            }
        }
    }
}

//This is the test class

@istest
public class TestExportEmailMessageDataController {
    public Static List<EmailMessage> Doc{get;set;}
	@istest  
    public static void testFuction(){
        test.startTest();
        Doc = new List<EmailMessage>();
        List<EmailMessage> emailList  = new  List<EmailMessage>();
        List<Case> caseList = new List<Case>();
         Case c = new Case();
        c.Subject = 'Om Test';  
        c.Status ='Closed';
        c.Priority = 'Medium';
        c.Origin = 'Email';
        insert c;
        Case c1 = new Case();
        c1.Subject = 'Om Test';  
        c1.Status ='Closed';
        c1.Priority = 'Medium';
        c1.Origin = 'Email';
        insert c1;
        caseList.add(c);
        caseList.add(c1);
  		  
       
        //Insert emailmessage for case
        EmailMessage email = new EmailMessage();
        email.FromAddress = 'test@abc.org';
        email.Incoming = true;
        email.ToAddress= 'test@xyz.org';
        email.Subject = 'Test email';
        email.HtmlBody = 'Test email body';
        email.ParentId = c.Id; 
        email.TextBody = 'test test test';
        email.RelatedToId =c.Id;
        email.CcAddress = 'deepak.potghan@aress.com';
        email.BccAddress = 'deepak.potghan@aress.com';
        email.Status  = '1';
        insert email;
        system.debug('Inserted  email'+email);
    
        
   
        ApexPages.StandardSetController stdSetController = new ApexPages.StandardSetController(caseList);
  		ExportEmailMessageDataController ext = new ExportEmailMessageDataController(stdSetController);
             ExportEmailMessageDataController.getEmailMessage();
        test.stopTest();
    }
}
HI All,

I have override the new button with lightning component. when I click new button from Parent Related list, I want to prepopulate the parentid in the custom component for this I want to get ParentId. I tried isurl addressable I'm able to get parentid, but its not working in the SF1. Is their any other work around.

Thanks in advance
 
Hi,
I'm Uploading managed package which gives me this error "permission set references custom object thas has M-D realtionship with Standard object". My upload fails. Can anyone tell me the workaround for this error. Master object is standard object and detail object is custom object. I have a permission set in managed package custom objects has permission in it.

Thanks,
Elearner.
Dear Community, I need your help,
I have created a lightning component and I wanted to display it in Opportunity new page. So for that, I override the "New" button on Opportunity for Mobile with a lightning component.
When a user clicks on the "New" button in salesforce one app,  After the user picks the record type. It does not going to lightning component page. 
We strongly need a lightning component page as salesforce mobile style. What can we do?
 
Hi Team,

How to remove namespace from the host url in the installed org. because I want to create a visualforce page from the managed pacakge apex class
Hi Team,

How can we write the test class for below class.
public with sharing class ControllerCls {
      
    public Contact co{get;set;}
    
    private final Contact con;
    
    private ApexPages.StandardController sc{get;set;}
    
    public Opportunity opp = new Opportunity();
    
    public ControllerCls(ApexPages.StandardController sc){
        this.sc = sc;
        con = (Contact)sc.getRecord();
        
        if(con.Name__c != Null){
            opp =[select id,name,AccountId from Opportunity where id =: con.Name__c limit 1];
        }
            
        co = new Contact();
        
        co.AccountId = opp.AccountId;
      
    }
    
    public PageReference save(){
        try{
            Database.insert(con);
            PageReference pr = new PageReference('/'+con.Id);
       		pr.setRedirect(true);
            return pr;
        }catch(Exception ex){
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, ex.getMessage()));
            return null;
        }        
    }
    
    public PageReference saveNew()
     { 
         PageReference pr; 
         try{
             Database.insert(con);
         Schema.DescribeSObjectResult describeResult = sc.getRecord().getSObjectType().getDescribe();
         pr = new PageReference('/' + describeResult.getKeyPrefix() + '/e');
         pr.setRedirect(true);
         return pr;
         }catch(Exception e){ 
         ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, e.getMessage()));
         return null; }
     
     }
    
}
Please let me know how can we cover 100% code coverage.

Thanks,
sfdc dev.
 
  • September 18, 2018
  • Like
  • 0
else if(ApexPages.currentPage().getParameters().get('RecordType') =='0127F000000erM4'){
             PageReference pageRef1 = new PageReference('/apex/Case_CustomEditPage');
             pageRef1.setRedirect(true);
             return pageRef1;
             }

 
A custom object "Participant"
In the object, a custom field, "Status" with two options: Participant or Applicant.

Under the Applicant status, only some of the custom fields are visible, eg:
Contact Info
Passport Number
Identity Number has an two option: Addhar No and Pan No
If pan no is selected output field for it should display or vise varsa.

Under the Participant status, the same custom fields and more are visible:
Contact Info
Passport number
T Shirt size
Medical/illness disclosure 
 
Hi All,

I'm trying to Integrate salesforce with magento. Can someone give me the sample code to connect with magento from salesforce.

Thanks
Hi,

Could some one please suggest me how to write a test class for  a class having more than one method.

Also i have provided the input for record update in test class.But code to executed for before update scenario is not covered by the test class. Could some one guide me what could be the reason.

Thanks & Regards,
BSIN
  • July 27, 2018
  • Like
  • 0
Hi guys,

I've been trying to use Lightning Open CTI to implement a softphone for Lightning Service Console. Click2dial-related functions work like a charm but screenPop() function keeps throwing this:

This page has an error. You might just need to refresh it. Action failed: c:TestCompo$controller$handleClick [Failed to execute 'postMessage' on 'Window': [object Object] could not be cloned.] Failing descriptor: {c:TestCompo$controller$handleClick}

I've created a Visualforce page and Call Center. The page contains Lightning components. Open CTI is included in page:
​<apex:includeScript value="/support/api/41.0/lightning/opencti_min.js"/>
Even a simple copy pasted code throws the error mentioned above:
sforce.opencti.screenPop({
    type: sforce.opencti.SCREENPOP_TYPE.SOBJECT,
    params: {
        recordId: '0012F0000089wQuQAI'
    }
});
I've double checked that account with hardcoded ID exists in the system.

Any idea how to solve this?
Thanks

 

Hi,

 

I have a visualforce page comprised of a div with a horizontal scroll bar with large number of fields. Due to such design, I don't have a horizontal scroll bar on the window, instead I have it on my div so that I can navigate over all the available fields.

 

If I have a date field at last in the div, the datePicker doesn't appears right there, but it gets rendered at it's absolute position, because of which I need to scroll the window horizontally.

 

Thanks in anticipation

Hi,

 

 Anybody explain am stuck to integrate salesforce with magento am passing parameters using http callout

this is my code am getting this response like :

 

oauth_problem=parameter_absent&oauth_parameters_absent=oauth_consumer_key

 

 

public void resp()
{
http H=new http();
HttpRequest req = new HttpRequest();
//String url= 'http://advaanz.com/magentoapitest/oauth/initiate';
req.setEndpoint('http://advaanz.com/magentoapitest/oauth/initiate');
//string Stringval='OAuth oauth_callback="'+EncodingUtil.urlEncode('https://c.ap1.visual.force.com/apex/megentoapi', 'UTF-8')+'",oauth_consumer_key="6nuzyesqo16saelvdazlodjvknurc2wh",oauth_consumer_secret="5fqgg8xrv9rvt88kz9o31bbe55zw6896"';

string Stringval='OAuth realm="http://advaanz.com/",oauth_consumer_key="6nuzyesqo16saelvdazlodjvknurc2wh",oauth_nonce="15ZN8FFR1700UQ6O",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1367319400",oauth_version="1.0",oauth_signature="4mphBg8VgYCV%2BeMIIMdZ%2BgD%2F6eM%3D"';
req.setMethod('POST');
req.setHeader('Content-length', '1753' );
req.setHeader('Content-Type', 'text/xml;charset=UTF-8');
string bVal=EncodingUtil.Base64Encode(blob.valueof(Stringval));
String authorizationHeader =bval;
req.setHeader('Authorization',bVal);
req.setbody('');
//req.setHeader('Accept','');
//req.setHeader('Host','api.magento.com');
req.setTimeout(50000);
HttpResponse res =h.send(req);
TestVal=res.getbody();
}

 

can any one explain how to integrate maganto using apex code?

 

Thankyou

 

Hi All

       I need to integrate magento with salesforce using API. I dont know about web services. can u please help me how to write that webservice class and how to integrate to magento.

 

please help me

 

Thanks & Regards

Anu.