• Jigar.Lakhani
  • NEWBIE
  • 477 Points
  • Member since 2014
  • Lead Specialist
  • Jade Global

  • Chatter
    Feed
  • 13
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 124
    Replies
Hi all

Thanks In Advc..


I am facing small bit of problem like want to data catagory in the form of series like 
aaa,bbb,ccc,ddd---Series1
eee,fff,ggg,iii-----Series2......Like this

i have one object having some field .when i am entering value with field aaa and click on save it will be saved in series1 catagory means data will be saved with respective series based on value..
Is there any way to solve this 
Public Map<Quote_line_item__c,list<batch__c>> blist{ get; set;}
public list<batch__c> ctlist{get; set;}
 Quote_line_item__c acc= new Quote_line_item__c(Master_Id__c='Qli'+count);
         ctlist=new list<batch__c>();
         batch__c ct=new batch__c(Dummy_field__c='BTH'+bcount,Quote_line_item__r=new Quote_line_item__c(Master_Id__c='Qli'+count));       
         ctlist.add(ct);
         blist.put(acc,ctlist);



Master_id__c is a link field between Quote_line_item__c and batch
For Every action I am using this map to put 

At last i want to insert those values in Map blist how can i do that help me ?
 
for(quote_line_item__c q:blist.keyset()){
       For(batch__c b:  ){
     }
     }

How to compete thsi save logic .Help me
Visual force Code:

<apex:page standardController="Contact" sidebar="false" showHeader="false" docType="html-5.0" applyHtmlTag="true" applyBodyTag="true" extensions="MyResponsiveForm1">    
<html>  
<head>


    <!-- Style-->
    <style>  
//Custom Error Message    
.errorStyle, .errorMsg, .importantWarning {    
        color: #d74c3b;
    }   
.requiredBlock {    
    background-color: #c00;
    position: absolute;
    width: 3px;
    height: 48px;
}    

.extraSpaceBelow{    
    margin-bottom:20px;
}            
.myMultiClass{           
  display: block;
  font-size: 14px;
  line-height: 1.42857143;
  color: #555;
  border: 1px solid #ccc;
  border-radius: 4px;  
}
.myMultiClass:focus {
  border-color: #66afe9;
  outline: 0;
  -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, .6);
          box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102, 175, 233, .6);
}   
.sf1button {    
font-size: 16px;
color: #44596c;
text-shadow: none;
margin: 0;
padding: 4px 14px;
height: 35px;
font-size: 16px;
font-family: 'ProximaNovaSoft-Regular';
font-weight: normal;
border: 1px solid #bbc0c4;
border-radius: 5px;
background: -moz-linear-gradient(#ffffff,#f1f1f1);
background: -webkit-linear-gradient(#ffffff,#f1f1f1);
background: -ms-linear-gradient(#ffffff,#f1f1f1);
background: linear-gradient(#ffffff,#f1f1f1);
box-shadow: none;
text-align: center;
cursor: pointer;
box-sizing: border-box;
}   

.sf1button:active {   
background: #e9e9e9;   
}   
</style>    


    <!-- MultiSelect Picklsit-->  
        <script type="text/javascript">
        var $j = jQuery.noConflict();
        $j(document).ready(function() {
            setTimeout(function() {
                $j('select.myMultiClass').each(function(i, val) { 
                    $j(val).width(110);
                    $j(val).height(110);
                })
            },100);
        });
       </script>


<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></apex:includeScript>      
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css"/>
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap-theme.min.css"/>
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>

</head>
<body>

<form name="userForm" novalidate="novalidate" >



    <div class="row clearfix">
        <div class="col-md-12 column" id="section1">
            <div class="panel list-group">                        
                <a class="list-group-item active" href="#collapsePersonalInformation" data-toggle="collapse" data-parent="#section1">Personal Information</a>
                <div id="collapsePersonalInformation" class="panel-collapse collapse">
                <br/>            
                    <apex:form >       


                    <apex:outputPanel id="firstPanel"  rendered="{!firstPanel}">                             
                    <div class="row">  

                        <apex:repeat value="{!$ObjectType.Contact.FieldSets.properNames}" var="f">
                            <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12 extraSpaceBelow">  
                                <div class="col-sm-4"><apex:outputlabel value="{!f.Label}"></apex:outputlabel> </div>                                    
                                <div class="col-sm-8"><apex:outputField styleClass="form-control" value="{!Contact[f.fieldPath]}" /></div>

                            </div>        

                        </apex:repeat> 
                            <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12 extraSpaceBelow">
                                <div class="col-sm-4"><apex:outputLabel >Testq Without Bootstrap style</apex:outputLabel></div>
                                <div class="col-sm-8"><apex:outputField value="{!Contact.Working_Days__c}" styleClass="myMultiClass"/></div>
                            </div>




                    </div> 

                    <apex:commandButton value="Edit" action="{!firstButton}"/>

                    </apex:outputPanel>


                    <apex:outputPanel id="secondPanel"  rendered="{!secondPanel}">


                    <div class="row">  

                        <apex:repeat value="{!$ObjectType.Contact.FieldSets.properNames}" var="f">
                            <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12 extraSpaceBelow">  
                                <div class="col-sm-4"><apex:outputlabel value="{!f.Label}"></apex:outputlabel> </div>                                    
                                <div class="col-sm-8"><apex:inputField styleClass="form-control" value="{!con[f.fieldPath]}" required="{!OR(f.required, f.dbrequired)}"/></div>

                            </div>        

                        </apex:repeat> 
                            <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12 extraSpaceBelow">
                                <div class="col-sm-4"><apex:outputLabel >Testq Without Bootstrap style</apex:outputLabel></div>
                                <div class="col-sm-8"><apex:inputField value="{!con.Working_Days__c}" styleClass="myMultiClass"/></div>
                            </div>




                    </div> 
                    <apex:commandButton action="{!save}"  value="Submit"  />
                    </apex:outputPanel>

                    </apex:form>                                                
                </div>

            </div>
        </div>
    </div>


    <div class="row clearfix">
        <div class="col-md-12 column" id="section1">
            <div class="panel list-group">                        
                <a class="list-group-item active" href="#collapsePersonalInformation" data-toggle="collapse" data-parent="#section1">PF1</a>
                <div id="collapsePersonalInformation1" class="panel-collapse collapse">
                <br/>            
                    <apex:form >       


                    <apex:outputPanel id="ss"  rendered="{!ss}">                             
                    <div class="row">  

                        <apex:repeat value="{!$ObjectType.Contact.FieldSets.properNames}" var="f">
                            <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12 extraSpaceBelow">  
                                <div class="col-sm-4"><apex:outputlabel value="{!f.Label}"></apex:outputlabel> </div>                                    
                                <div class="col-sm-8"><apex:outputField styleClass="form-control" value="{!Contact[f.fieldPath]}" /></div>

                            </div>        

                        </apex:repeat> 
                            <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12 extraSpaceBelow">
                                <div class="col-sm-4"><apex:outputLabel >Testq Without Bootstrap style</apex:outputLabel></div>
                                <div class="col-sm-8"><apex:outputField value="{!Contact.Working_Days__c}" styleClass="myMultiClass"/></div>
                            </div>




                    </div> 

                    <apex:commandButton value="Edit" action="{!sss}"/>

                    </apex:outputPanel>


                    <apex:outputPanel id="ss1"  rendered="{!ss1}">


                    <div class="row">  

                        <apex:repeat value="{!$ObjectType.Contact.FieldSets.properNames}" var="f">
                            <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12 extraSpaceBelow">  
                                <div class="col-sm-4"><apex:outputlabel value="{!f.Label}"></apex:outputlabel> </div>                                    
                                <div class="col-sm-8"><apex:inputField styleClass="form-control" value="{!con[f.fieldPath]}" required="{!OR(f.required, f.dbrequired)}"/></div>

                            </div>        

                        </apex:repeat> 
                            <div class="col-lg-6 col-md-6 col-sm-12 col-xs-12 extraSpaceBelow">
                                <div class="col-sm-4"><apex:outputLabel >Testq Without Bootstrap style</apex:outputLabel></div>
                                <div class="col-sm-8"><apex:inputField value="{!con.Working_Days__c}" styleClass="myMultiClass"/></div>
                            </div>




                    </div> 
                    <apex:commandButton action="{!sss1}"  value="Submit"  />
                    </apex:outputPanel>

                    </apex:form>                                                
                </div>

            </div>
        </div>
    </div>




    </form>
    </body>
    </html>


</apex:page>


Apex  code: 

public with sharing class MyResponsiveForm1 {    



    public boolean firstPanel{get;set;}
   public boolean secondPanel{get;set;}
   public boolean firstPanel1{get;set;}
   public boolean secondPanel1{get;set;}
   public contact con{get;set;}

   public boolean ss{get;set;}
   public boolean ss1{get;set;}
    public MyResponsiveForm1(ApexPages.StandardController controller) {
        con=(Contact)controller.getRecord();
        firstPanel = true;
        ss= true;
    }
    public PageReference edit() {
         firstPanel=false;
      secondPanel= true;
      return null;
    }
    public PageReference save() {
        update con;
         firstPanel=true;
      secondPanel=false;
      return null;

    }
    public void sss1() {
        update con;
         ss=true;
      ss1=false;


    }
    public void firstButton()
    {
      firstPanel=false;
      secondPanel= true;

    }
    public void sss()
    {
      ss=false;
      ss1= true;

    }



}



this code working good but edit the record then click the submit button which gives some error:

System.DmlException: Update failed. First exception on row 0; first error: MISSING_ARGUMENT, Id not specified in an update call: []
Error is in expression '{!save}' in component <apex:commandButton> in page boostrapdemo: Class.MyResponsiveForm1.save: line 24, column 1
Class.MyResponsiveForm1.save: line 24, column 1


please give me solution for this

Thanks
Satheesh
Here is soql i want get ids of attachments as follows and how can i retrieve ids from the list
 
list<Account> accs = [select (select id from attachments where createddate < last_N_days:10) from account where is_read__c = true]

Now i want ids of attachments into a seperate list how it is possible..

Thanks in advance
Hi,
i have crated vf page with 6 div section..
$(document).ready(function () {   
              $('.step2, .step3, .step4, .step5, .step6').hide();   
               
        });
        function showStep(step_name){
                if(is_validate && is_valid){
                    $('.step, .step2, .step3, .step4, .step5, .step6').hide();
                    $('.'+step_name).fadeIn();
            }
        } 

<div class"step">          
                <apex:commandButton value="Next" onclick="showStep('step3'); return false;"/>
some field is here......
</div>

<div class"step2">
                <apex:commandButton value="Back" onclick="showStep('step'); return false;"/>
                <apex:commandButton value="Next" onclick="showStep('step3'); return false;"/>
some field is here......
</div>

<div class"step3">
                <apex:commandButton value="Back" onclick="showStep('step'); return false;"/>
                <apex:commandButton value="Next" onclick="showStep('step3'); return false;"/>
some field is here......
</div>

and so on
when i click the next button vf page reload....
pls help me out
 
Need to create a Workflow that sends an email notifying user when a 'Billing Type' picklist value changes FROM "Credit Card" TO any other picklist value.  Intent is to notify Accounting to stop the credit card billing.  Any ideas???
Hi folks,
         Can anyone tell me how to get the custom error message(red color) in visualforce after disabling the show header and standard stylesheet?

Below is my VFP for getting Custom Error Message
<apex:page standardController="Contact" standardStylesheets="false" showHeader="false"  >

<apex:pageBlock >
    <apex:form >
        <apex:pageMessages ></apex:pageMessages>
        <apex:inputField value="{!contact.lastname}" html-placeholder="Enter Your Last Name"/>
        <apex:commandButton action="{!save}" value="Submit"/>
    </apex:form>
</apex:pageBlock>
</apex:page>


But the page gives lafter clicking submit button 

User-added image


But I want to display error message in red color.

For that what I have to do?


Thanks in advance
Karthick
 
We have following requirement:

1. Case object has 3 record types say "Product1 Record Type", "Product2 Record Type" and "Product3 Record Type"
2. There is a Lookup for Product in Case object
3. While searching for a product lookup as part of creating new Case object, only those Products shud be displayed that matches product name with current case record type.
For eg. Let us say I have already created products named "Product1" , "Product2"  and "Product3" . I am creating a case object with its record type as say "Product1 Record Type" and for product lookup, it shud display only those products whose product name contains in the current case record, which in this scenario is "Product1" under Lookup filter dialog results. 
Similarly, for case with "Product2 Record Type"  shud display "Product2" under Lookup dialog results. 

How to achieve this. I tried under lookup filter without any success. Please help.
Reference: Visualforce Developer guide
The constructor methods on the associated custom controller or controller extension classes are called, instantiating the controller objects.
The action attribute on the <apex:page> component is evaluated, and all other method calls, such as getting or setting a property value, are made.

But in some blogs I am seeing the order as constructor, getter methods and page action method respectively.

But from the Visualforce developer guide it should be constructon, page action method and getter methods respectively.

Please help me with my confusion?
Hi All,

i am getting too many SOQL queries error when my below class executed. i noticed that soql Queries inside the for loop but i don't have the idea HOW can I write the SOQL queries OUTSide the For LOOP as per my requirement. Below is my Util calss for my trigger. Please help me on this 


public class OLIUtil{
     
    public static void createProject(String OppID){
        
    List<Attachment> aList;
        List<Attachment> newAList=new List<Attachment>();
        
        Project__c newProj;
    
    List<Project_LI__c> PrjLIList=new List<Project_LI__c>();
    
    List<OpportunityLineItem> OppProdList=[Select id,TotalPrice,Subtotal,Product2.Name,ProductCode,Product2.Id,Opportunity.Name,
                             from OpportunityLineItem where Opportunity.Id=:newOpp.Id];
        // make sure we don't create duplicates project records
             if ([select count() from Project__c where Project_Name__c = :NewOpp.Id] == 0) 
             {
                 newProj=new Project__c();
                 newProj.Project_Name__c=NewOpp.Id;
                 newProj.Project_Stage__c='In Progress';
                 insert newProj;
                 Project_LI__c newPrjLI;
                     for(OpportunityLineItem oppLI:OppProdList)
                     {
                            newPrjLI=new Project_LI__c();
                            newPrjLI.LI_Name__c=oppLI.Product2.Name;
                            newPrjLI.Project_Name__c=newProj.Id;
                            newPrjLI.LI_Number__c=oppLI.ProductCode;
                            newPrjLI.Quantity__c=oppLI.Quantity;                      
                            
                            PrjLIList.add(newPrjLI);
                     }
                 insert PrjLIList;
        
                 List<Project_LI__c> addedLI=[select id,name,Project_Name__c,LI_Name__c from Project_LI__c where Project_Name__c=:newProj.Id];
                 
         for(Project_LI__c newAddedLI:addedLI){   // In this for Loop I have written 3 SOQL queries. How can I write these 3 SOQL s to Out side?
                    
            Project_LI__c ddd=[Select id,name,LI_Name__c,Project_Name__c from Project_LI__c where id=:newAddedLI.Id];
                    
            Product2 oppProd=[Select id,name from Product2 where name=:ddd.LI_Name__c];
                    
            aList=[Select Id,name,body,ParentId from Attachment where ParentId=:oppProd.Id];
                    
                    if(aList.size()!=0){
                        for(Attachment aa:aList)
                         {
                             Attachment a=new Attachment();
                                 a.name=aa.name;
                                 a.body=aa.body;
                                 a.ParentId=newAddedLI.id;
                                newAList.add(a);
                         }
                    }
                 }
                 insert newAList;
             }
    }
}

Thanks,
Yarram
  • November 21, 2014
  • Like
  • 0
Hi

I have use the following javascript code to Custom button, How to implement the code to visualforce?

Code
==========
{!REQUIRESCRIPT("/soap/ajax/30.0/connection.js")} 

var SS = sforce.connection.query("select id,Visit__c from Engineer_Checklist__c where Visit__r.id='{!Visits__c.Id}' and Fire_Extinguisher_Service_complete__c=True"); 
var records1 = SS.getArray("records"); 


var RS = sforce.connection.query ("select id,Visit__c from Service_Sheet_STD__c where Visit__r.id='{!Visits__c.Id}' and Fire_Extinguisher_Service_complete__c=True"); 
var records2 = RS.getArray("records"); 


var MSS = sforce.connection.query ("select id,Visit__c from Mechanical_Service_Sheet__c where Visit__r.id='{!Visits__c.Id}' and Fire_Extinguisher_Service_complete__c=True"); 
var records3 = MSS.getArray("records"); 


var SW = sforce.connection.query ("select id,Visit__c from Small_Works__c where Visit__r.id='{!Visits__c.Id}' and Submit_this_Small_Works_Sheet__c=True"); 
var records4 = SW.getArray("records"); 


var PS = sforce.connection.query("select id,Visit__c from Project_Sheet__c where Visit__r.id='{!Visits__c.Id}' and Fire_Extinguisher_Service_complete__c=True"); 
var records5 = PS.getArray("records"); 


if((records1.length!=0 || records2.length!=0 || records3.length!=0 || records4.length!=0 || records5.length!=0) && 
confirm("You have already submitted a sheet for this visit, are you sure you want to submit another one?")){ 

window.open("https://cs16.salesforce.com/a1Z/e?CF00ND0000005FbyJ={!Visits__c.Name}&CF00ND0000005FbyJ_lkid={!Visits__c.Id}&retURL={!Visits__c.Site_Contract__c}&CF00ND0000005FcIJ_lkid","_top") 

else if(records1.length==0 && records2.length==0 && records3.length==0 && records4.length==0 && records5.length==0) 

window.open("https://cs16.salesforce.com/a1Z/e?CF00ND0000005FbyJ={!Visits__c.Name}&CF00ND0000005FbyJ_lkid={!Visits__c.Id}&retURL={!Visits__c.Site_Contract__c}&CF00ND0000005FcIJ_lkid","_top") 
}
Hi guys have a
page :.
<apex:commandButton value="First" onclick="getscore('First')" />
</apex:pageBlock>
<apex:actionFunction action="{!score}" name="getscore"  reRender="content">
 <apex:param name="myParam" value=""/>
</apex:actionFunction>

Extension  method:

public void score() {
        string passedParam1 = Apexpages.currentPage().getParameters().get('myParam');
        system.debug('ssssssssssssss'+passedParam1);
    }

The method is not being called at all any help here would be appreciated
Hi Folks,

I am building a LWC to load external JS script file in LWC. However whenever loadScript function is executing it is failing to load and there is not error received.

LWC
import { LightningElement, track  } from 'lwc';
import { loadScript } from 'lightning/platformResourceLoader';
import BrandfolderJS from '@salesforce/resourceUrl/BrandfolderJS';

export default class brandFolderLink extends LightningElement {
	
    @track blnBrandfolderJSInitialized = false;
    
    renderedCallback() {

        if (this.blnBrandfolderJSInitialized) {
            return;
        }
        this.blnBrandfolderJSInitialized = true;

        loadScript(this, BrandfolderJS)
        .then(() => {
            alert('success.......');
        })
        .catch(error => {
            alert('failed.....'+error);
        });
    }
	
}

JS file from Static Resource - Brandfolder JS (https://cdn.brandfolder.com/bf.min.js)
I have created JS file as static resource (BrandfolderJS) and using it in LWC.

LWC is added to App Builder Page/Home Page and trying to load, however it is going to catch block in loadScript method without any error. Error variable is undefined.

Can you please help?

Thank you,
Jigar Lakhani

Hello,

I have requirement to implement random forest algoritm in salesforce apex code.
Can anyone help about, How can I implement radom forest algorithm in apex as well where can I found the requirement like which/how methods needs to prepare for implement that algorithm.

Thanks,
Jigar (pateljb90@gmail.com)
Hi Folks,

I am building a LWC to load external JS script file in LWC. However whenever loadScript function is executing it is failing to load and there is not error received.

LWC
import { LightningElement, track  } from 'lwc';
import { loadScript } from 'lightning/platformResourceLoader';
import BrandfolderJS from '@salesforce/resourceUrl/BrandfolderJS';

export default class brandFolderLink extends LightningElement {
	
    @track blnBrandfolderJSInitialized = false;
    
    renderedCallback() {

        if (this.blnBrandfolderJSInitialized) {
            return;
        }
        this.blnBrandfolderJSInitialized = true;

        loadScript(this, BrandfolderJS)
        .then(() => {
            alert('success.......');
        })
        .catch(error => {
            alert('failed.....'+error);
        });
    }
	
}

JS file from Static Resource - Brandfolder JS (https://cdn.brandfolder.com/bf.min.js)
I have created JS file as static resource (BrandfolderJS) and using it in LWC.

LWC is added to App Builder Page/Home Page and trying to load, however it is going to catch block in loadScript method without any error. Error variable is undefined.

Can you please help?

Thank you,
Jigar Lakhani

Hi Folks,

I am building a LWC to load external JS script file in LWC. However whenever loadScript function is executing it is failing to load and there is not error received.

LWC
import { LightningElement, track  } from 'lwc';
import { loadScript } from 'lightning/platformResourceLoader';
import BrandfolderJS from '@salesforce/resourceUrl/BrandfolderJS';

export default class brandFolderLink extends LightningElement {
	
    @track blnBrandfolderJSInitialized = false;
    
    renderedCallback() {

        if (this.blnBrandfolderJSInitialized) {
            return;
        }
        this.blnBrandfolderJSInitialized = true;

        loadScript(this, BrandfolderJS)
        .then(() => {
            alert('success.......');
        })
        .catch(error => {
            alert('failed.....'+error);
        });
    }
	
}

JS file from Static Resource - Brandfolder JS (https://cdn.brandfolder.com/bf.min.js)
I have created JS file as static resource (BrandfolderJS) and using it in LWC.

LWC is added to App Builder Page/Home Page and trying to load, however it is going to catch block in loadScript method without any error. Error variable is undefined.

Can you please help?

Thank you,
Jigar Lakhani

Hi Guys,

I want to pass recordID from a LWC Component to a apex class in connectedCallback method.,But sommehow i am getting the value as null inside the class, Not able to understand where i am going wrong,
Can anyone please help me out .

export default class AddContacToDl extends LightningElement {
connectedCallback() {
var rcid= this.recordId;
console.log('rcid---beofre----'+rcid);
getSelectedDLDetails({contactIDname:this.rcid})
.then(data => {
console.log('data------'+data);
for(var i=0; i<data.length; i++) {
console.log('id=seleccted' + data[i]);
this.distvalue = [...this.distvalue ,{value:data[i], label: data[i]}];
}
this.error = undefined;
}).catch(error=>{
this.error = error;
this.distvalue = undefined;
})
}

Apex class-

@AuraEnabled
public static List<String> getSelectedDLDetails(String contactIDname)
{
System.debug(LoggingLevel.info,'ID value------'+contactIDname);
HI All,
Thanks in advance!! 
I have created visualforce page & displaying result dynamically below is the controller of my class:
public with sharing class DoctorsListdata1 {


    public Myforce_Campaign__c cmpg{get;set;}
    public Myforce_Campaign__c cmpg1{get;set;}
    public Patch_Customer__c pc{get;set;}
    public List<Patch_Customer__c> selectedAccounts{get;set;}
     public Id cmpId;
   public Decimal maxLimit{get;set;}
     
    public DoctorsListdata1(ApexPages.StandardController controller) {
        this.cmpg = (Myforce_Campaign__c)controller.getRecord();
         cmpId = ApexPages.CurrentPage().getParameters().get('id');
        cmpg.Id = apexpages.currentpage().getparameters().get('Id');
        system.debug('Plan ID' +cmpg.Id);
        
        cmpg1 = [select id, name,Speciality__c,Class__c,Visit_Frequency__c,Max_Doctor_Participation_Count__c,Min_Doctor_Participation_Count__c FROM Myforce_Campaign__c WHERE Id=:cmpId];
        maxLimit = cmpg1.Max_Doctor_Participation_Count__c;
        pharmaProductList();
    }
    
   Public List<PatchCusWrapper> productList{get;set;}
   public List<PatchCusWrapper> pharmaProductList(){
         productList = new List<PatchCusWrapper>();
         
         list<String> Speciality = new list<String>();
         
         system.debug(cmpg1);
         system.debug(cmpg1.Speciality__c);
         if(cmpg1.Speciality__c <> null)
         
         for(String str : cmpg1.Speciality__c.split(';'))
            {
            String lpmstr = '\'' +str+'\'';
            String lpm1 = '';
            lpm1 = lpm1 + lpmstr;
               Speciality.add(lpm1);


            }

List<String> Class1 = new List<String>();
for(String str : cmpg1.Class__c.split(';'))
            {
            String lpmstr = '\'' +str+'\'';
            String lpm1 = '';
            lpm1 = lpm1 + lpmstr;
               Class1.add(lpm1);


            }
list<String> Frequency = new list<String>();
for(String str : cmpg1.Visit_Frequency__c.split(';'))
            {
            String lpmstr = '\'' +str+'\'';
            String lpm1 = '';
            lpm1 = lpm1 + lpmstr;
               Frequency.add(lpm1);


            }



string Doctor='Doctor';
string status='Approved';
List<Patch_Customer__c> pcList = new List<Patch_Customer__c>();
String query='Select Id,First_Name__c,Last_Name__c,Patch__c,Patch__r.Name,Speciality__c,Graduation__c,Class__c,Frequency__c,City__c, Hospitals_Name__c from Patch_Customer__c WHERE RecordType.Name = \'' +Doctor+'\' ';


        if(cmpg1.Speciality__c !=null ){
            cmpg1.Speciality__c= cmpg1.Speciality__c.replace(';', ',');
            query +=  ' AND Speciality__c IN ' +Speciality;
        }
        
        if(cmpg1.Class__c !=null ){
            query +=  ' AND Class__c IN ' +Class1;
        }
        
        if(cmpg1.Visit_Frequency__c !=null ){
            query +=  ' AND Frequency__c IN ' +Frequency;
        }
         query += '  LIMIT 1000';
system.debug(query);
        pcList= Database.query(query);
         
             // List<Patch_Customer__c> pcList = [Select Id,First_Name__c,Last_Name__c,Patch__c,Patch__r.Name,Speciality__c,Graduation__c,Class__c,Frequency__c,City__c, Hospitals_Name__c from Patch_Customer__c WHERE RecordType.Name = 'Doctor' limit 5];
             system.debug(pcList);
             
             List<Id> customerList = new List<Id>();
                Map<Id, Patch_Customer__c> customerMap = new Map<Id, Patch_Customer__c>();
                for(Patch_Customer__c p : pcList){
                    customerList.add(p.Id);
                    customerMap.put(p.Id, p);
                }
   List<Campaign_Data__c> cdList = [SELECT Id, Customer__c FROM Campaign_Data__c WHERE Myforce_Campaign__c =:cmpg.Id ];
          
             Map<Id, Campaign_Data__c> cdMap = new Map<Id, Campaign_Data__c>();
             for(Campaign_Data__c b : cdList){
                 cdMap.put(b.Customer__c, b);
             }
             for(Id c : customerList){
             
                 if(cdMap.get(c) !=null){
                     productList.add(new PatchCusWrapper(cdMap.get(c),customerMap.get(c), true)); 
                 }
                 else{
                     Campaign_Data__c ppp = new Campaign_Data__c();
                     productList.add(new PatchCusWrapper(ppp, customerMap.get(c), false)); 
                }
             }
             system.debug('sdfkgfdgk jdfg hj');
         system.debug(productList);
         return productList;
     }

The above query is working fine when even I am selecting less than 9 Speciality from the picklist value,but whenever I am choosing more than 10 values in speciality .I am getting the below error:

System.QueryException: expecting a colon, found '.'
Class.DoctorsListdata1.pharmaProductList: line 86, column 1
Class.DoctorsListdata1.<init>: line 19, column 1

Thanks in advance.

Regards
Subrat
  • October 09, 2019
  • Like
  • 0
. Create a new PickList “Custom Status” in Opportunity object.(New,Open,Close,Reset) values.When this field changed and value is “Reset” now then delete all associated products(opp. Lines)
with related Opportunity
when ever parent picklist chages automatically child picklist values should be chage
ex: my parent picklist 1,2,3,4
     child picklist values 1a,1b,2a,2b....like that
   
Hi Experts,

I need in below image yellow color line meaning.

User-added image
Create a Scheduler to mail to Opportunity Owner , if not modified for last 30 days.
In Opportunity, If the stage is changed from another value to CLOSED_WON or CLOSED_LOST,populates the Close Date field with Today().
Hi All

I am trying the below to access the lookup field's value and I get null.
ObjA.fieldA__c =  ObjB.fieldB__r.Name 
where fieldB is a lookup field to object C
Whats wrong here ? 

 
  • July 08, 2015
  • Like
  • 0
Hi

I have created a Vf page .but i am unable to use two page block table in single page block.how its possible can any body tell me
 
<apex:page tabstyle="Account" showHeader="false" sidebar="false" Controller="ManageListController1">

<apex:define name="body">
            
            <div style="width:900px;margin: 10px auto 10px auto;background-color:Gray;">
            
 <apex:form >
 

   <apex:pageBlock title="Bank Book Entry:">
      <apex:pageBlockSection columns="2"> 
      
      <apex:pageBlockTable value="{!wrappers1}" var="wrapper1" id="wtable1">
      <apex:column headerValue="Date" style="background:gray;">
           <apex:outputText value="{!wrapper1.Txn_Date__c}"/>
         </apex:column>
      
      
      </apex:pageBlockTable>
      
          
   <div style="width:500px;margin: 10px auto 10px auto;">
   
      <apex:pageBlockTable value="{!wrappers}" var="wrapper" id="wtable">
       
         <apex:column headerValue="Ident" style="background:gray;">
            <apex:outputText value="{!wrapper.ident}"/>
         </apex:column>
         <apex:column headerValue="Master Code" style="background:gray;">
            <apex:inputField value="{!wrapper.acc.Entries_Code__c}"/>
         </apex:column>
         <apex:column headerValue="Amount" style="background:gray;">
            <apex:inputField value="{!wrapper.acc.Amount__c}"/>
         </apex:column>
         <apex:column headerValue="Narration" style="background:gray;">
            <apex:inputField value="{!wrapper.acc.Narration__c}"/>
         </apex:column>
          
       <apex:column headerValue="">
            <apex:commandButton value="Enter" action="{!addRows}" rerender="wtable" style="background:pink" >
         <apex:param name="addCount" value="1" assignTo="{!addCount}"/> 
      </apex:commandButton>
         </apex:column>
       
         <apex:column headerValue="Action">
            <apex:commandButton value="Delete" action="{!delWrapper}" rerender="wtable" style="background:Red">
               <apex:param name="toDelIdent" value="{!wrapper.ident}" assignTo="{!toDelIdent}"/> 
            </apex:commandButton>
         </apex:column>
         
      </apex:pageBlockTable>
     </div>
        
        
      <apex:commandButton value="Add 5 Rows" action="{!addRows}" rerender="wtable" style="width:100px;margin: 10px auto 10px auto;">
         <apex:param name="addCount" value="5" assignTo="{!addCount}"/> 
      </apex:commandButton>
      
      <apex:commandButton value="Save" action="{!save}" style="width:100px;margin: 10px auto 10px auto;"/>
   
     </apex:pageBlockSection>
     </apex:pageBlock>
 </apex:form>
  </div>
        </apex:define>
</apex:page>
 
public class ManageListController1 
{

    
    public ManageListController1(ApexPages.StandardController controller) {

    }

 public List<AccountWrapper> wrappers {get; set;}
  public List<AccountWrapper> wrappers1 {get; set;}
 public static Integer toDelIdent {get; set;}
 public static Integer addCount {get; set;}
 private Integer nextIdent=0;
  
 public ManageListController1()
 {
  wrappers=new List<AccountWrapper>();
  Wrappers1=new List<AccountWrapper>();
  for (Integer idx=0; idx<1; idx++)
  {
   wrappers.add(new AccountWrapper(nextIdent++));
    wrappers1.add(new AccountWrapper(nextIdent++));
   
  }
 }
  
 public void delWrapper()
 {
  Integer toDelPos=-1;
  for (Integer idx=0; idx<wrappers.size(); idx++)
  {
   if (wrappers[idx].ident==toDelIdent)
   {
    toDelPos=idx;
   }
  }
   
  if (-1!=toDelPos)
  {
   wrappers.remove(toDelPos);
  }
 }
  
 public void addRows()
 {
  for (Integer idx=0; idx<addCount; idx++)
  {
   wrappers.add(new AccountWrapper(nextIdent++));
  }
 }
  
 public PageReference save()
 {
  List<BankBook__c> accs=new List<BankBook__c>();
  for (AccountWrapper wrap : wrappers)
  {
   accs.add(wrap.acc);
  }
   
  insert accs;
   
  return new PageReference('/' + Schema.getGlobalDescribe().get('BankBook__c').getDescribe().getKeyPrefix() + '/o');
 }
 
 public pageReference parentPage () {

          return new pageReference('/apex/Receivables');
} 
  
  
  
 public class AccountWrapper
 {
  public BankBook__c acc {get; private set;}
  public Integer ident {get; private set;}
   
  public AccountWrapper(Integer inIdent)
  {
   ident=inIdent;
   acc=new BankBook__c();
  }
 }
}

 
Hi all

Thanks In Advc..


I am facing small bit of problem like want to data catagory in the form of series like 
aaa,bbb,ccc,ddd---Series1
eee,fff,ggg,iii-----Series2......Like this

i have one object having some field .when i am entering value with field aaa and click on save it will be saved in series1 catagory means data will be saved with respective series based on value..
Is there any way to solve this