• osacar soto
  • NEWBIE
  • 0 Points
  • Member since 2019
  • online survey
  • info tech

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 4
    Replies
I'm new to visualforce but trying to edit a page built by another. I need to set a picklist value, that can be changed on the form, to a value defined in the URL.

The URL that is pass includes:

?channel=email&market=1&lang=en

I'm trying to set the market picklist here:

<div class="new-subform-component form-group field">
     <label for="select_market" class="control-label id="select_market">{!$Label.Select_Market}:</label>
     <div>
          <apex:inputField value="{!caseObj.Case_Market__c}"
               Styleclass="form-control caseMarket" required="true" id="market" onchange="UpdateCountryCode()" />
     </div>
</div>

This is pulling the options from the Case.Case_Market__c field. Each Market(Country) as an API value that is a number but of course the number is considered text type.

If I add an onload function:

window.onload=function() {
                $('.caseMarket').val('1');
        };

This works, 1 = USA

Anything refencing the URL parameter, doesn't work such as:

var xMarket = '{($CurrentPage.parameters.market == null, '1', $CurrentPage.parameters.market)}';

window.onload=function() {
            if (xMarket == "1"){
                $('.caseMarket').val('1');
            } else if (xMarket == "2") {
                $('.caseMarket').val('2');
            }
            UpdateCountryCode()
        };

Or setting the .caseMarket by parameter on load:

window.onload=function() {
     $('.caseMarket').val('$CurrentPage.parameters.market');
}

I have tried many, many different ways of doing this, all failing. Ideas?

Hi my friends, 

I am trying to store more than 60,000 record from Batch apex result, and I have to edit the record with schedulable apex every 5 mins. 


So, 
Can I store this data in a global variable? I googled it, but all I can find was for Normal global variable. 

Would you be able to direct me to the link or show me a simple code line please? 


Thank you :)

 

Can anyone help me fix the code I am getting the below error

search term must be longer than one character: s
Error is in expression '{!runQuery}' in component <apex:commandButton> in page productsearchpopupcontroller: Class.ProductSearchPopupController.runQuery: line 63, column 1
An unexpected error has occurred. Your development organization has been notified.

global class ProductSearchPopupController {
   
    public String query {get; set;}
    public List<PricebookEntry__c> products {get; set;}
    public List<wrapProduct> wrapProductList {get; set;}
    public List<PricebookEntry__c> selectedProduct{get;set;}
    public List<QuoteLineitem__c> quoteLineList{get;set;}
    public List<wrapProduct> selectedWrapperList{get;set;}
    public Boolean normalList{get;set;}
    public Boolean selectedList{get;set;}
    public Boolean block{get;set;}
    public Boolean block1{get;set;}
    public Boolean block2{get;set;}
    public String SalesPrice {get; set;}
    public integer Discount {get; set;}
    public String Quantity {get; set;}
    public String ServiceDate {get; set;}
    Id recordId;
   
    public ProductSearchPopupController(ApexPages.StandardController controller){
        recordId = controller.getId();
        SalesPrice='';
        Discount=0;
        Quantity='';
        ServiceDate='';
        system.debug('recordId '+recordId);
        wrapProductList = new List<wrapProduct>();
        selectedWrapperList = new List<wrapProduct>();
        normalList = true;
        selectedList = false;
        block = true;
        block1 = false;
        block2 = false;
        
    }
   
     public PageReference runQuery1(){
         
        List<PricebookEntry__c> searchResults=[select id, Name, ProductCode__c, Product2Id__r.Product_Description__c,UnitPrice__c, UseStandardPrice__c from PricebookEntry__c];
        if(searchResults.size() >= 0){
            
            for(PricebookEntry__c a: searchResults) {
                // As each Account is processed we create a new wrapAccount object and add it to the wrapAccountList
                wrapProductList.add(new wrapProduct(a));
                block = true;
                block1 = true;
                block2 = false;
            }
        }
        return null;
    }
    
    public PageReference runQuery(){
        wrapProductList = new List<wrapProduct>();
        if(query == null || query == ''){
            system.debug('query '+query);
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Info,'Please enter Product to search for'));
               runQuery1();
           
        }

        system.debug('query '+query);
        List<List<PricebookEntry__c>> searchResults=[FIND :query IN ALL FIELDS RETURNING PricebookEntry__c (id, Name, ProductCode__c, Product2Id__r.Product_Description__c,UnitPrice__c, UseStandardPrice__c)];
        if(searchResults[0]!=null){
            for(PricebookEntry__c a: searchResults[0]) {
                // As each Account is processed we create a new wrapAccount object and add it to the wrapAccountList
                wrapProductList.add(new wrapProduct(a));
                block = true;
                block1 = true;  

                block2 = false;

            }
        }
        return null;
    }
    public PageReference ProceedWithSelectedToNextPage(){
        selectedWrapperList = new List<wrapProduct>();
        normalList = false;
        selectedList = true;
        for(wrapProduct selectedWrapObj: wrapProductList){
            system.debug('selectedWrapObj.selected  ---------'+selectedWrapObj.selected);
            if(selectedWrapObj.selected == true)
                selectedWrapperList.add(selectedWrapObj);
        }
        system.debug('selectedWrapperList size ---------'+selectedWrapperList.size());
        PageReference pageRef = new PageReference('/apex/AccountOpportunityTwoPage');
        pageRef.setRedirect(false);
        return pageRef;
    }
    public void processSelected() {
        selectedProduct = new List<PricebookEntry__c>();
        for(wrapProduct wrapProductObj : wrapProductList) {
            if(wrapProductObj.selected == true) {
                selectedProduct.add(wrapProductObj.acc);
                block = false;
                block1 = false;
                block2 = true;
               
            }
        }
    }
   
    public void GoBack() {
        block = true;
        block1 = true;
        block2 = false;
    }
   
    global class wrapProduct{
        public PricebookEntry__c acc {get;set;}
        public Boolean selected {get;set;}
        public wrapProduct(PricebookEntry__c p) {
            this.acc = p;
            this.selected = false;
        }
       
    }
   
    public pagereference saveproduct(){
        List<QuoteLineitem__c> quoteLineList = new  List<QuoteLineitem__c>();
         if(Test.isRunningTest()){
            insertTestData();
        }
        if(!selectedProduct.isEmpty()){
            for(PricebookEntry__c sp:selectedProduct){
                system.debug('sp '+sp);
                QuoteLineitem__c qli = new QuoteLineitem__c();
                qli.QuotesId__c = recordId;
                qli.ListPrice__c = sp.UnitPrice__c;
                qli.UnitPrice__c = sp.UnitPrice__c;
                qli.Product2Id__c = sp.Product2Id__c;    
                if(Discount!=0 || Discount!=null){
                    qli.Discount__c = Discount;
                }
                if(Quantity!=null){
                    qli.Quantity__c = Decimal.valueof(Quantity);
                }
                quoteLineList.add(qli);
            }
            
           
            if(quoteLineList.size() > 0){
                insert quoteLineList;
                PageReference pageRef = new PageReference('https://proseraa.lightning.force.com/lightning/r/Quotes__c/'+recordId+'/view');
                pageRef.setRedirect(true);
                return pageRef;
            }
        }
        return null;
    }
    public void insertTestData(){
        Product2__c testProduct = new Product2__c();
            testProduct.Name='Test product';
            insert testProduct;
            PricebookEntry__c testpbe = new PricebookEntry__c();
                testpbe.Name='Test PriceBookEntry';
                testpbe.UnitPrice__c =123;
                testpbe.Product2Id__c=testProduct.Id;
                insert testpbe;
            selectedProduct.add(testpbe);
    }
    
}
I tried to figure out if there is a way to set up Outlook LIghtning Sync such that Exchange can identify that client via a certificate.  I know it uses TLS but that verifies the server, not the client.  What I would like is a way to put a certificate in an org such that the Exchange server can then verify that the traffic came specifically from that org.