• Jack123
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 14
    Questions
  • 9
    Replies

On Send email button When I am selecting Template using Insert Template button I am seeing all the Templates. 

What I want is when user Click on Insert Template button he can oinly see selected Templates which I want.
is this something which we can do or not

Thanks  

When I am selecting Custom or Visualforce email Template on Send an Email button I am not able to modify the content of the Template. It says "This email Template Content Cannot be modified"

So is this a limitation in Salesforce or I am missing some permission or something.

If its a limitation can you guys give me the Salesforce Link where it is specified 

Thank you in advance

Hi Everyone

I have one Vf page which I am displaying as MS Doc using content type as Ms Doc. 
Everything is working fine execpt for one thing that I add one logo on header but Its not displaying Logo image instead its showing some error

I have tried all the approach like using static resource or adding the image on document, tried everthing but still its not displaying image 

See the error screen shot
User-added image

Here is the code for all the approaches I tried 
<div style='mso-element:header' >
                            <p class="MsoHeader" style="text-align:right;">
                                Header Content
                                <img src="{!URLFOR($Resource.LOGOImage)}" style="float:right;" width="50" height="50"/>
                                <apex:image url="{!$Resource.LOGOImage}" width="50" height="50"/>"
                               <apex:image url="MyDomain/servlet/servlet.ImageServer?id=recordID&oid=orgid&lastMod=SomeID" style="float:right;" width="132" height="65"/>
                               <img src="MyDomain/servlet/servlet.ImageServer?id=recordID&oid=orgid&lastMod=SomeID" style="float:right;" width="132" height="65"/> 
       
                            </p>
                        </div>
I have one custom button on clicking on that I am opening one VF page which I have rendered as PDF after opening I am seeing Loading Icon and Label on tab.
Anyone know how to reslove this 

User-added image

Thank you in advance

I need to get the object wise page layout names. is there any app exchange package or some other way we can find the page layout names object wise using schema class or any other method ?

 

Thank you in advance 

I want to display Salesforce Standard Report on VF page. LIke 2 Report on 1 VF page side by side. So I Used iframe to Display Standard report on Vf page 

<apex:Iframe src="https://cs72.salesforce.com/00O5D000000G2Rg" scrolling="true" id="theIframe" />

But i gives me "Refused to display 'https://cs72.salesforce.com/00O5D000000G2Rg' in a frame because it set 'X-Frame-Options' to 'sameorigin'."

error and does not display anything.

Can anyone help me how we can display Standard report on Vf page ?

Thank you in Advance 

I have a custom object called "Job" and contract is the parent object of Job.

Now what i want is on the contract detail page on the related list of Job object I need one custom button and when i click on that button i want ot prepopulated some fields value on the jobs standard edit page. 

I want this functioanlity in lightning Experience.

We can do this easily in Salesfore classic using URL hacking but URL hacking is not possible in lighting experience.

So i need a workaround for this that how can i do this in lightning experince.

I have heard that if we need to pepopulated fields values in lightning experience then we need to use Quick action. but quick action buttons are avalible on the objects detail page and i want that button on the Job related list.

Can anyone help me how we can achieve this or any workaround for this 

 

Thanks you in advance 

I want to create one Custom button and on click of that button I want to open PDF.

So i created Vf page for this which is renderAS=PDF it works fine

but now When i clich on that button I want to opne the PDF and at the same time want to save the same PDF as a attachment in Attachment object in saleforce.

here is my Vf page code
<apex:page standardController="WorkOrder" showHeader="false" sidebar="false"  extensions="CustomPDFController" renderAs="pdf"  action="{!SaveAtt}" >
    <apex:form >
        
        <apex:pageBlock tabStyle="Account" title="Work Order">
            &nbsp;&nbsp;<apex:outputLabel value="Name : "> &nbsp;&nbsp;&nbsp;&nbsp;
            <apex:outputText value="{!wkorderlist[0].WorkOrderNumber}"></apex:outputText></apex:outputLabel>
            
            &nbsp;&nbsp; <apex:outputLabel value="Status : "> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <apex:outputText value="{!wkorderlist[0].status}"></apex:outputText></apex:outputLabel>
            
            &nbsp;&nbsp; <apex:outputLabel value="Priority : "> &nbsp;&nbsp;&nbsp;&nbsp;
            <apex:outputText value="{!wkorderlist[0].Priority}"></apex:outputText></apex:outputLabel>
        </apex:pageBlock>
        
        <apex:repeat value="{!MapList}" var="key">
            <apex:pageBlock title="Customer Asset Name" >
            </apex:pageBlock>
            <apex:outputText value="{!key}"/> &nbsp;&nbsp;&nbsp;
            <apex:pageBlock title="Work Order Line Items">
                <apex:pageBlockTable value="{!MapList[key]}" var="lists">
                    <apex:column value="{!lists.LineItemNumber}"/>
                    <apex:column value="{!lists.Status}"/>
                    <apex:column value="{!lists.Discount}"/>
                    <apex:column value="{!lists.DurationType}"/>
                    <apex:column value="{!lists.Priority}"/>
                </apex:pageBlockTable>
            </apex:pageBlock>
        </apex:repeat>
    </apex:form>
</apex:page>

this is my class code

public class CustomPDFController{
   
    public String currentRecordId {get;set;}
    public Map<String,List<WorkOrderLineItem>> MapList {get;set;}
    public list<Customer_Asset__c> customerAssertlist {get;set;}
    public list<workorder> wkorderlist {get;set;}
    public CustomPDFController(ApexPages.StandardController stdController){
    
        MapList = new map<String,list<WorkOrderLineItem>>();
        currentRecordId  = ApexPages.CurrentPage().getparameters().get('id');
        system.debug('currentRecordId >>>>>>>> ' +currentRecordId);
        
        customerAssertlist = [select Name, Account__c,Division__c,Work_Order__c,Parent_Customer_Asset__c,(select Id,LineItemNumber,Status,Discount,DurationType,Priority from Work_Order_Line_Items__r where WorkOrderId =:currentRecordId) from Customer_Asset__c  ];
        
        wkorderlist = [select Id,WorkOrderNumber,status,Priority from workorder where Id =:currentRecordId];
        for(Customer_Asset__c cusAsObj : customerAssertlist){
            if(cusAsObj.Work_Order_Line_Items__r.size() > 0){
                MapList.put(cusAsObj.Name, cusAsObj.Work_Order_Line_Items__r);
            }
        }
        /*system.debug('MapList >>>>>>>>>>>>> ' +MapList);
         PageReference pdf = new PageReference('/apex/CustomPDFControllerSec?id='+currentRecordId);
        PageReference pdf = Page.CustomPDF;
        //prep attachment   
        //pdf.getParameters().put('id', currentRecordId);
        
        Attachment attach = new Attachment();
        Blob b = pdf.getContent();
        attach.Body = b;
        attach.Name = 'invoice.pdf';
        attach.IsPrivate = false;
        attach.ParentId = currentRecordId;
        //insert attach ;*/
        
    }
    
    public void SaveAtt(){
        //PageReference pdf = new PageReference('/apex/CustomPDFv2?id='+currentRecordId);
        //prep attachment  
        PageReference pdf = Page.CustomPDF; 
        system.debug('DDEREREREGGGG '+pdf) ;
        pdf.getParameters().put('id', currentRecordId);
        
        Attachment attach = new Attachment();
        Blob b;
        try{
            b = pdf.getContentAsPDF();
        } catch (VisualforceException e) {
            b = Blob.valueOf('Some Text');
        }
        system.debug('FDFDFDF '+b) ;
        attach.Body = b;
        attach.Name = 'invoice.pdf';
        attach.IsPrivate = false;
        attach.ParentId = currentRecordId;
        attach.ContentType = 'application/pdf';
        insert attach ;
        
    }
    
    @AuraEnabled
    public static void emailInvoice(String RecordId){
        
        PageReference pdf = Page.CustomPDF; 
        pdf.getParameters().put('id', RecordId);
        //pdf.setRedirect(true); //does not seem to be required
        
        list<attachment> attlst =new list<attachment>();
        Messaging.Singleemailmessage mail = new Messaging.Singleemailmessage();
       
        Blob b = pdf.getContentAsPDF();
        system.debug('dddffdfdfd '+b) ;
        Messaging.EmailFileAttachment efa = new Messaging.EmailFileAttachment();
        efa.setFileName('invoice.pdf');
        efa.setBody(b);
        string[] toAddr = new string[] {'rohit.dhiman@360degreeapps.com'};
        mail.setToAddresses(toAddr);
        
        mail.setSubject('Your Invoice from ' + UserInfo.getOrganizationName());
        
        mail.setHtmlBody('Thanks for attending:<b> ' + UserInfo.getOrganizationName() +' </b><p>'+
                         ' Your Invoice is attached.');
        
        mail.setFileAttachments(new Messaging.Emailfileattachment[] {efa}); 
        
        Messaging.SendEmailResult [] r = Messaging.sendEmail(new Messaging.SingleEmailMessage[] {mail});  
        system.debug('Mail Sent >>>>>>>>>> ' +r);
       

    }
}

So while opening the VF page from the custom button I am getting error as 
Too many nested getContent calls. 

So can anyone please help me out in this 

 

Thank you in advance

There is a online software called Mindbody. Mindbody provide some API's to fetch the data from the Mindbody.

I also want to do the same in salesforce. I want to fetch the client's data by hitting the API using the Apex class.

Can anyone done the Mindbody and salesforce integration before.

Can anyone help me I have not worked on the Integration before. 

I have custom text field in which I will store the address information. Now I want to find out the Latitude and Longitude of the Address stored in the custom address field. 

can anyone help me how I can find out the latitude and longitude values.

Thank you in advance

I get the single email limit exceeded error very frequently.

I am calling the apex class from process builder and I am getting this error.

can anyone help me what can be the issue.

 

This is my class code which i am calling from process builder.

public class sendEmailWithSignatureHandler{
    
    public static String orgWideId;
    public static List<Messaging.SingleEmailMessage> emails;
    
    @InvocableMethod
    public static void sendEmailWithTemplate(WrapperClass[] listOfWrapperClass)
    {
      system.debug('&&&^^^%%%%% '+listOfWrapperClass.size()) ;
      OrgWideEmailAddress[] owea = [select Id from OrgWideEmailAddress where Address = 'contact@daoact.org'];
      //Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
      
      if (owea.size() > 0 ) {
          orgWideId = String.valueOf(owea.get(0).Id);
      }
      
      Map<String,EmailTemplate> mapOfTemplateId = new Map<String,EmailTemplate>();
      Set<String> setOfTemplateIds = new Set<String>();
      
      for(WrapperClass objWrapperClass : listOfWrapperClass)
      {
          setOfTemplateIds.add(objWrapperClass.TemplateName) ;
      }
      for(EmailTemplate emp : [select id,subject,htmlvalue from EmailTemplate where Id In : setOfTemplateIds])
      {
           mapOfTemplateId.put(String.valueOf(emp.Id).substring(0, 15),emp) ;
      }
      
      emails = new List<Messaging.SingleEmailMessage>();
      
      for(WrapperClass objWrapperClass : listOfWrapperClass){
          
          sendEmail(objWrapperClass.objLead, objWrapperClass.TemplateName,mapOfTemplateId);
      }
      system.debug('$$$###### '+emails.size()) ;
      System.debug('You have made ' + Limits.getEmailInvocations() + ' email calls out of ' + Limits.getLimitEmailInvocations() + ' allowed');
      if(emails.size() > 0)
      {
        Messaging.sendEmail(emails); 
      } 
        
   }
   
    private static void sendEmail(lead__c objLead,String tempId,Map<String,EmailTemplate> mapIdToTemplate){
        
        try{
          //List<Messaging.SingleEmailMessage> emails = new List<Messaging.SingleEmailMessage>();

         Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
         String body ;
         String subject ;
        
         if(mapIdToTemplate.get(tempId) != null){
             body = mapIdToTemplate.get(tempId).htmlvalue;
             subject = mapIdToTemplate.get(tempId).subject ;
         }
         
         String signatureName ;
         
         if((objLead.If_applying_for_Pre_Release_Access__c == '' || objLead.If_applying_for_Pre_Release_Access__c == null) && objLead.Correct_Answer__c == 4)
         {
            signatureName = 'Signature 1';
         }
         else if((objLead.If_applying_for_Pre_Release_Access__c == '' || objLead.If_applying_for_Pre_Release_Access__c == null) && objLead.Correct_Answer__c < 4)
         {
            signatureName = 'Signature 2';
         }
         else if(objLead.If_applying_for_Pre_Release_Access__c == 'Less Than 1 Ether' && objLead.Correct_Answer__c == 4)
         {
            signatureName = 'Signature 3';
         }
         else if(objLead.If_applying_for_Pre_Release_Access__c == 'Less Than 1 Ether' && objLead.Correct_Answer__c < 4)
         {
            signatureName = 'Signature 4';
         }
         else if(objLead.If_applying_for_Pre_Release_Access__c == 'Between 1 and 50 Ether' && objLead.Correct_Answer__c == 4)
         {
            signatureName = 'Signature 5';
         }
         else if(objLead.If_applying_for_Pre_Release_Access__c == 'Between 1 and 50 Ether' && objLead.Correct_Answer__c < 4)
         {
            signatureName = 'Signature 6';
         }
         else if(objLead.If_applying_for_Pre_Release_Access__c == 'Over 50 Ether' && objLead.Correct_Answer__c != null)
         {
            signatureName = 'Signature 7';
         }
        
         List<Signature__c> lstOfSign = [select name, Signature__c from Signature__c where name =: signatureName ] ;
         
         body += '<br><br>'+(lstOfSign.size() > 0?lstOfSign[0].Signature__c:'test') ;
         system.debug('%%%%$$$$ '+body) ;
         
         body = body.replace('{!Lead.Name}',objLead.name) ;
         body = body.replace('{!Lead.Correct_Answer__c}',objLead.Correct_Answer__c != null ? String.valueOf(objLead.Correct_Answer__c).subString(0,String.valueOf(objLead.Correct_Answer__c).indexOf('.')) : '') ;
         body = body.replace('</br>','<br>') ;
         mail.setToAddresses(new List<String>{objLead.email__c});
         mail.setSubject(subject);
         mail.setHTMLBody(body);
         mail.setOrgWideEmailAddressId(orgWideId);
         emails.add(mail) ;
         
        /* if(emails.size() > 0)
         {
            Messaging.sendEmail(emails); 
         }*/

        }

        catch(Exception e)
        {
        
        }
    }  
    
    public class WrapperClass{
     
      public WrapperClass(){
          
      }
      @InvocableVariable
      public lead__c objLead ;
      
      @InvocableVariable
      public String TemplateName ;
      
    
    }
     
     
}

  • September 13, 2017
  • Like
  • 0
So my requirement is I want all the salesforce attachment backup in google drive also I can syncronise the salesforce with google drive so that in future if I will upload any attachment in salesforce it will automaticallu added to the google drive

Can anyone help me how we can do this using third party app or any other way we can intergrate salesforce with google drive 
I am using the salesforce object type community page in Napili community. Whle opening the record detail page on the right side it displays "Chatter isn't enabled or the user doesn't have Chatter access.". can anyone tell me how can i remove this. 
how to override the navigation tab with the visualforce page in napili community

I need to get the object wise page layout names. is there any app exchange package or some other way we can find the page layout names object wise using schema class or any other method ?

 

Thank you in advance 

When I am selecting Custom or Visualforce email Template on Send an Email button I am not able to modify the content of the Template. It says "This email Template Content Cannot be modified"

So is this a limitation in Salesforce or I am missing some permission or something.

If its a limitation can you guys give me the Salesforce Link where it is specified 

Thank you in advance

Hi Everyone

I have one Vf page which I am displaying as MS Doc using content type as Ms Doc. 
Everything is working fine execpt for one thing that I add one logo on header but Its not displaying Logo image instead its showing some error

I have tried all the approach like using static resource or adding the image on document, tried everthing but still its not displaying image 

See the error screen shot
User-added image

Here is the code for all the approaches I tried 
<div style='mso-element:header' >
                            <p class="MsoHeader" style="text-align:right;">
                                Header Content
                                <img src="{!URLFOR($Resource.LOGOImage)}" style="float:right;" width="50" height="50"/>
                                <apex:image url="{!$Resource.LOGOImage}" width="50" height="50"/>"
                               <apex:image url="MyDomain/servlet/servlet.ImageServer?id=recordID&oid=orgid&lastMod=SomeID" style="float:right;" width="132" height="65"/>
                               <img src="MyDomain/servlet/servlet.ImageServer?id=recordID&oid=orgid&lastMod=SomeID" style="float:right;" width="132" height="65"/> 
       
                            </p>
                        </div>
I have one custom button on clicking on that I am opening one VF page which I have rendered as PDF after opening I am seeing Loading Icon and Label on tab.
Anyone know how to reslove this 

User-added image

Thank you in advance

I need to get the object wise page layout names. is there any app exchange package or some other way we can find the page layout names object wise using schema class or any other method ?

 

Thank you in advance 

I want to display Salesforce Standard Report on VF page. LIke 2 Report on 1 VF page side by side. So I Used iframe to Display Standard report on Vf page 

<apex:Iframe src="https://cs72.salesforce.com/00O5D000000G2Rg" scrolling="true" id="theIframe" />

But i gives me "Refused to display 'https://cs72.salesforce.com/00O5D000000G2Rg' in a frame because it set 'X-Frame-Options' to 'sameorigin'."

error and does not display anything.

Can anyone help me how we can display Standard report on Vf page ?

Thank you in Advance 


<apex:component allowDML="true">
<apex:attribute name="pkbCon" type="pkb_Controller" required="true" description="handle to the pkb controller" />
<apex:attribute name="HomeCatgryName" type="string" required="false" description="category name from home page" />
<apex:variable var="category" value="{!pkbCon.selectedCategory}" />
<!-- POPULAR PAGE SIZE: {!pkbCon.popularArticles}<br/> RESULTS PAGE SIZE: {!pkbCon.articlesPerPage}<br/> CURRENT PAGE: {!pkbCon.currPage}<br/> LANG: {!pkbCon.selectedLanguage}<br/> CATEGORY USED: {!category}<br/> categories={!category}.. /summary={!a.summary} / articleTypeName={!a.articleTypeName} / articleTypeLabel={!a.articleTypeLabel} / -->
<!-- 15June,2015 --> <apex:variable var="categoryTyp" value="{!IF(HomeCatgryName == 'consumerBtnLink', 'Topics:All', 'Military:All')}"/>
<apex:variable var="categoryTyp" value="{!IF(HomeCatgryName == 'militryBtnLink', 'Military:All', 'Topics:All')}"/> <!-- categories="{!category}" -->
<div> <!--<h2 class="section">{!$Label.PKB2_Popular_Articles}</h2>--> <knowledge:articleList articleVar="a" language="{!pkbCon.selectedLanguage}"
sortBy="mostViewed" pageSize="{!pkbCon.popularArticles}"
categories="{!categoryTyp}" pageNumber="1">
<c:pkb_article pkbCon="{!pkbCon}"
aid="{!a.id}"
title="{!a.title}"
summary="{!a.summary}"
urlName="{!a.urlName}"
articleTypeName="{!a.articleTypeName}"
articleTypeLabel="{!a.articleTypeLabel}"
lastModifiedDate="{!a.lastModifiedDate}"
firstPublishedDate="{!a.firstPublishedDate}"
lastPublishedDate="{!a.lastPublishedDate}"
FromHomeCatgryName="{!HomeCatgryName}" />
</knowledge:articleList>
</div>
</apex:component>