• Narveer Singh
  • 19 Points
  • Member since 2014

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
  • 13
Hi Team,

I am creating a Custom Quote template i.e. Steel Brick Quote template.On Data mapping like primary contact Name etc.It is creating its own css.When i am using my CSS it is not picking or merging fields in template.

Can you please help.


I want to assign the owner based on the round robin logic. I have used one custom object based on the condition the owner will be assigned dynamically. I have used record like below.

Campus    User
C1             U1
C1             U2
C2             U1
C2             U2

If the campus as C1 the record will be assigned to U1 and next time assigned to U2. Similarly, it will work for remaining campus. Please help me how to achieve this.

Hi Techie's,

Can any one help out with a trigger that restricting dupicate opportunitylineitems 

Hi There,

We have a business process to execute batch inserts/updates and Searches. Here is the scenario, We have a community Portal where external users will select List of records (custom records) based on a certain logic. This list may have up to 100-500 records.
And based on their selection, we have to process them. Like create Accounts, Contacts and create set of Custom records, send email alerts etc.. + Searches. This process is significantly heavy. And after inserting some of above custom records, there are triggers + Apex classes to run too. This will simply exceeds most of the governor limits.
Apparently this community was in a Client side application previously, where we used SOAP API to handle the Process. In that way we didn't have to bother about governor limits.
So I seek the help from yours to understand the best option to follow to implement this. Few options we are considering right now is,
Using Batch Apex
Using BulkTK - BulkTK
Using @future
Use Apex REST?
Appreciate your help here to understand the best possible approach. Or else please share your thoughts

Many Thanks, Lahiru
  • September 01, 2016
  • Like
  • 1
Hi Folks,

I need to get the attachments from EmailMessage. Is there any way to get it ? EmailMessage object has a property called hasattachments but how to get attachments and its body ?


  In my Salesforce organisation from setup i entered sandbox but i can't find it.
  could anyone please help on this?
   Thanks in Advance.....
what is the difference between standard Controller and Custom Controller in accessing the Visual Force Page
Hello guys,

I have 2 visualforce pages and 1 apex controller extension for both. On the first page I capture some information that is displayed on the second page (renderAs PDF). 

There is no problem showing a pdf preview with the following code:
public PageReference showPDF()
  PageReference test = Page.Sales_Offer_PDF;
  test.getParameters().put('Id', o.Id);

  return test;
Though its still the first page in the url.

But if I want to save the second page as a pdf file, it completely ignores the second page and tries to get the content from the first page.
Following Code:
public void savePDF()
        PageReference pdf = new PageReference('/apex/Sales_Offer_PDF?id='+o.Id+'&pdf=true');
        //PageReference pdf = Page.Sales_Offer_PDF;               Both ways dont work...
        //pdf.getParameters().put('Id', o.Id);

        Blob body;

        ContentVersion v = new ContentVersion();
        try {
            body = pdf.getContent();
        } catch (VisualforceException e) {
            body = Blob.valueOf('Some Text');
            System.debug('### Exception savePDF: '+e);
        v.versionData = body;
        v.title = 'Offer ('+Date.today().format()+').pdf';
        v.pathOnClient ='/Offer ('+Date.today().format()+').pdf';
        v.ProtectedFile__c = false;        

        insert v;

        ID cdId = [SELECT Id, ContentDocumentId FROM ContentVersion WHERE ID =: v.Id].ContentDocumentId;

        ContentDocumentLink cdl = new ContentDocumentLink();
        cdl.ContentDocumentId = cdId;
        cdl.ShareType = 'V'; 
        cdl.LinkedEntityId = o.Id;
        cdl.Visibility = 'AllUsers'; 

        insert cdl;
Btw. Im developing for Lightning Experience right now.
Can someone help me to save the second vf page as a pdf file. I need the same controller to keep the same view state..
Hi everyone,

Suppose I have a "print this" hyperlink at the end of the visual force page on clicking it I want the Visual force page to open in a new window as pdf giving users direct option to print. I know with chrome we can print by right clicking mouse and so on.. but I need this print hyperlink to work.
I have tried Render as="pdf" method but since the page has complex coding structure its not working.

is there anyway I can use jsPdf library or Pdf.js library and execute the above as function. I need a way to know how can I export all the data on the visual form page to the new window as pdf?
Hi there,
is it possible to show "All" values without the action "onchange" ? I want to see the values when i load the page and  when i select the item.

<apex:page controller="LeadPageControllerFilter" tabStyle="SalesFunnel__c">
      <apex:form >
        <apex:pageBlock title="Leads">
            <apex:pageBlockSection title="Meine Leads" columns="1">
                Select Industry to Filter list:
                <apex:selectList size="1" value="{!industryPickvalue}">
                    <apex:actionSupport event="onchange" action="{!getleads}" rerender="table1"/>
                    <apex:selectOption itemLabel="All" itemValue="All"></apex:selectOption> 
                    <apex:selectOption itemLabel="Value A" itemValue="Value A" ></apex:selectOption>
                    <apex:selectOption itemLabel="Value B" itemValue="Value B" >
                <apex:pageBlockTable id="table1" value="{!leadList}" var="l" columnsWidth="80%, 20%">
                    //columnsWidth="400px, 100px, 400px, 200px, 200px, 50px"                            
                    <apex:column >
                        <apex:facet name="header">Name</apex:facet>
                        <apex:outputLink value="/{!l.Id}" target="_blank">
                            <apex:outputField value="{!l.company}"/>
                    <apex:column value="{!l.Lead_Score__c}" />     

Thanks Guys  ;) 
public class lonchangeaccount{
        public id aid{get;set;}
        public boolean render{get;set;}
        List<selectoption> options=new List<selectoption>();
        public  List<Contact> lstcont{get;set;}
        public lonchangeaccount(){
                    lstcont=new List<contact>();
        Map<id,List<contact>> maplstcont=new Map<id,List<contact>>();
        public List<SelectOption>  getValues(){
                options.add(new selectOption('--None--','--None--'));
                for(Account acc:[select id,name,(select id,name,email from contacts)from account]){
                    options.add(new selectOption(acc.id,acc.name));
                return options;
        public void  Contactlst(){

VF Page
<apex:page controller="lonchangeaccount">
<apex:form >
         <apex:pageBlock title="Select Account">
         <apex:actionFunction action="{!Contactlst}" name="change"/>
         <apex:selectList value="{!aid}" multiselect="false" size="1" onchange="change();">
                <apex:selectOptions value="{!values}"/>
            <apex:pageBlock title="Related Contacts" >
          <apex:outputPanel rendered="{!render}" id="balu">
              <apex:pageBlockTable value="{!lstcont}" var="c">
                      <apex:column value="{!c.name}"/>
                      <apex:column value="{!c.email}"/>
             <apex:commandButton value="Next"/>

HI ,

Find accounts which are enabled as partner user  and doesn't have partner user ?