• Ivaylo Dimov
  • NEWBIE
  • 5 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 4
    Replies
I have a VF pages that takes on parameters, and when a "Search" button is clicked, a call is made to an external source. The returned results should be displayed on an output panel that rerenderes after the results become available. My "Search" button has a rerender tag as part displaying a spinner, but it loads the OutputPanel before it had the chance to return any data, hence why my results never get populated on the outputPanel. I can see the reuslts in my debug logs. Is there a way to rerender an outputannel after the data is available?

Trying to add help text to a field on my SLDS VF page. I found that I should use tooltip which seems to work for the most part. What I can not figure out is how to set the help text to apper when I hover over the info icon. Here is my code:

   <div class="slds-form-element__icon">
    <button class="slds-button slds-button_icon slds-button slds-button_icon" aria-describedby="help" aria-disabled="true" title="Help">
      <svg class="slds-button__icon" aria-hidden="true">
        <use xlink:href="{!URLFOR($Asset.SLDS, 'assets/icons/action-sprite/svg/symbols.svg#info')}"></use>
      </svg>
      <span class="slds-assistive-text">Help</span>
    </button>
  <div class="slds-popover slds-popover_tooltip slds-nubbin_bottom-left slds-slide-from-top-to-bottom slds-rise-from-ground" role="tooltip" id="help" style="position:absolute;top:-90px;left:-16px">
    <div class="slds-popover__body">{!$ObjectType.Contact.fields.Deceased__c.InlineHelpText}</div>
  </div>
  </div>

I am able to send an email from VF page, and am getting the emails with the proper text formatting, but I am not getting the letterhead associated to the email template that I am referencing. Is that even possible? Based on my research it seems like other folks have the same problem. My email template has letterhead that i would like to utilize, but it is not coming over with the email. Has anyone done anything similar?
 
EmailTemplate emailTemplate = [select Id, DeveloperName, HtmlValue, Body From EmailTemplate where DeveloperName = 'LTRO_Additional_Documents_Required'];
    //////////////////////////////////////////////////////        
           String htmlBody = emailTemplate.HTMLValue;
           htmlBody = htmlBody.replace('NewEmail', emailBody);
           mail.setHtmlBody(htmlBody);
    ///////////////////////////////////////
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });

 
Hi,
I am trying to write a test class for a custom controller, that is using URL tags as variables.
Here is my controller:

public class LTRORequireAdditionalDocumentsCon {
    
    
    public LTRO_Document__c ltrodoc {get;set;}
    private String caseId;
    private String conEmail;
    private String contName;
    
    public List<LTRO_Document__c> ltrodoclist {get; set;}
   
    public LTRORequireAdditionalDocumentsCon(){
        
        ltrodoc = new LTRO_Document__c();
        ltrodoclist = new List<LTRO_Document__c>();
        caseId = ApexPages.currentPage().getParameters().get('cid');
        conEmail = ApexPages.currentPage().getParameters().get('conemail');
        contName = ApexPages.currentPage().getParameters().get('conname');
       
    }
    
    
    public List<SelectOption> getLtroDocTypes(){
        
        List<SelectOption> options = new List<SelectOption>();
  
        Schema.DescribeFieldResult fieldResult = LTRO_Document__c.Type__c.getDescribe();
        List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
        
        for( Schema.PicklistEntry f : ple){
            options.add(new SelectOption(f.getLabel(), f.getValue()));
        }  
       // options.add(new SelectOption('','--None--'));
        
        return options;
    }
    
    public void addDocs(){
        if(ltrodoc.Summary__c !=''){
            LTRO_Document__c tmp = new LTRO_Document__c();
            tmp = ltrodoc.clone();
            //list
            ltrodoclist.add(tmp);
            //  docList.add(tmp);
            
            System.debug('temp :' + ltrodoclist);
            
        }
        
        else{
            System.debug('No Documents have been assigned');
        }
                
        System.debug('Documents Type: ' +ltrodoclist);
    }
   
    public void sendClientEmail(){
        
        String[] strList = new String[0];
        for(LTRO_Document__c docs: ltrodoclist){
            strList.add(String.valueOf(docs));
        }
        String result = String.join(strList, ' \n <br/>');
        System.debug('Result: ' + result);
        
        String regExp = 'Type__c=';
        String replacement = '';
        String tresult = result.replaceALL(regExp, replacement);
        System.debug('fresult: ' + tresult);
        
        String regExp1 = 'Summary__c=';
        String sresult = tresult.replaceAll(regExp1, replacement);
        System.debug('sresult: ' + sresult);
       
        String regExp2 = 'LTRO_Document__c:';
        String lresult = sresult.replaceAll(regExp2, replacement);
        System.debug('lresult: ' + lresult);
        
        String regExp3 = '[{}]';
        String cresult = lresult.replaceAll(regExp3, replacement);
        System.debug('cresult: ' + cresult);
        // Case casecon = [Select Contact.Name, Contact.Email from Case Where id =: caseId];
        
        Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
        
        String[] toAddresses = new String[] {conEmail};
            //String[] ccAddresses = new String[] {'smith@gmail.com'};
            
            mail.setToAddresses(toAddresses);
        //        mail.setCcAddresses(ccAddresses); 
        
        mail.setReplyTo('no-reply@test.org');
        
        mail.setSenderDisplayName('Services');
        
        mail.setSubject('Assessment Application - Additional Documents are Required : ' + case.Id);
        
        mail.setBccSender(false);
        
        // Specify the text content of the email.
        mail.setPlainTextBody('We have identified that additional documents are required' + cresult
                              +' please provide the needed information'); //case.id
        
        mail.setHtmlBody('We have identified that additional documents are required<b> <br/> ' 
                         + cresult +' <br/></b> Please provide the needed information. <br/></b>'+
                        '<br><br><a href="https://link?cid={!Case.Id}">Survey</a>');
        
        // Send the email you have created.
        Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
        
    }
}
 
Hi, we have Wave configured, and upload successfully files into our Prod org on weekly bases. I spun off a partial sandbox, and I tried loading one of the files into the Sandbox, but recieved an erro: Could someone give me a pointer into where I should bee looking at. I looked at the JSON code for the Transaction Data, but could not identify where exactly the error lies. I am assuming since it is a different Sandbox, there must be something additional to be configure, but not sure what? Could you help me?
Status:Failed
Reason for Failure:Error executing node dataset: Error in GetEdgemartCurrentData for edgemart Transaction_Data: No edgemarts found with specified URL:esObject/edgemart?current=true&alias(02KR00000008ckmMAA_03CR00000008g4aMAA)
I am able to send an email from VF page, and am getting the emails with the proper text formatting, but I am not getting the letterhead associated to the email template that I am referencing. Is that even possible? Based on my research it seems like other folks have the same problem. My email template has letterhead that i would like to utilize, but it is not coming over with the email. Has anyone done anything similar?
 
EmailTemplate emailTemplate = [select Id, DeveloperName, HtmlValue, Body From EmailTemplate where DeveloperName = 'LTRO_Additional_Documents_Required'];
    //////////////////////////////////////////////////////        
           String htmlBody = emailTemplate.HTMLValue;
           htmlBody = htmlBody.replace('NewEmail', emailBody);
           mail.setHtmlBody(htmlBody);
    ///////////////////////////////////////
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });

 
I've gone through every step successfully but am banging my head against the wall with step 8. I have more than adequate code coverage but continue to get this error message:
User-added image
I have gone back and rewritten OrderTests twice according to the requirements but can't get past this error. Anyone else had any luck with this?

Here's my code for reference:
@isTest (SeeAllData=false)
private class OrderTests {
    
    static void SetupTestData() {
	    TestDataFactory.InsertTestData(5);
    }
 
    @isTest static void OrderExtension_UnitTest() {
        PageReference pageRef = Page.OrderEdit;
        Test.setCurrentPage(pageRef);
        SetupTestData();
        ApexPages.StandardController stdcontroller = new ApexPages.StandardController(TestDataFactory.orders[0]);        
        OrderExtension ext = new OrderExtension(stdcontroller);        
       	System.assertEquals(Constants.DEFAULT_ROWS, ext.orderItemList.size());
        ext.OnFieldChange();
        ext.SelectFamily();
        ext.Save();
        ext.First();
        ext.Next();
        ext.Previous();
        ext.Last();
        ext.GetHasPrevious();
        ext.GetHasNext();
        ext.GetTotalPages();
        ext.GetPageNumber();
        List<SelectOption> options = ext.GetFamilyOptions();
    }
    
@isTest
public static void OrderUpdate_UnitTest(){
    setupTestData();
    
   
    Test.startTest();
    
    List<Order> orders = TestDataFactory.orders;
    for (Order o : orders){
        o.Status = Constants.ACTIVATED_ORDER_STATUS;
    }
    List<Product2> oldProducts = TestDataFactory.products;
    Set<Id> productIds = new Set<Id>();
    for (Product2 oldProd : oldProducts){
        productIds.add(oldProd.Id);
    }
    oldProducts = [SELECT Id, Quantity_Ordered__c FROM Product2 WHERE ID IN :productIds];
    Map<Id, Integer> quantities = new Map<Id, Integer>();
    for (OrderItem oi : TestDataFactory.orderItems){
        Integer quantity = 0;
        List<PricebookEntry> pricebookentries = TestDataFactory.pbes;
        for (PricebookEntry pbe : pricebookentries){
            if (oi.PricebookEntryId == pbe.Id){                
                if (quantities.containsKey(pbe.Product2Id)){
                    quantity = quantities.get(pbe.Product2Id);
                }
                quantity += (Integer)oi.Quantity;
                quantities.put(pbe.Product2Id, quantity);
                break;
            }
        }
    }
   
    update orders;
    Map<Id, Product2> currentProducts = new Map<Id, Product2>([Select Id, Quantity_Ordered__c FROM Product2 WHERE Id IN :productIds]);
  
    for (Product2 prod : oldProducts){
      
        TestDataFactory.VerifyQuantityOrdered(prod, currentProducts.get(prod.Id), quantities.get(prod.Id));
  }
  Test.stopTest();
}
}

 

Hello. I have a Force.com Site domain configured, and a Force.com site. The Force.com Site domain shows under Domains > My Domains. I can query the Site object, and it has the proper SubDomain value.

According to the docs, I should be able to query the Domain object and find this Force.com Sites domain. Also, there should be a DomainSite record linking the Site to the Domain. Right?

I query both the Domain and DomainSite objects (as a System Administrator), and both queries return no results.

I want to check, from Apex code (or using the Metadata API or something) whether there's a Force.com Sites domain set already on the org, and it's sub-domain component. Even when there are no sites created (I guess in that case I could query for a Site record with Type = Force.com Site, and use the SubDomain value?).

The final objective here, is being able to programatically create a Force.com Site. We intend to use the Metadata API for doing this.

Any ideas? Thanks!

  • September 28, 2016
  • Like
  • 1
Hi,
 
Is there a way to programatically use the letterhead in sendmail api.
I cannot use the template as the email contains references to  multiple objects and have to create the email in my apex code.
 
I still need to retrieve the letterhead specified in an email template and use that programatically to send the mail.
 
 
 
thanks,
Rohit