• prabhat jha
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 13
    Questions
  • 13
    Replies
Hello Friends,
I am working on Work with GeoJSON and Create the Map
Get the GeoJSON File Challenge under (
Create a Custom Map for Einstein Analytics Charts ) using https://developer.salesforce.com/files/custom_map_project_geojson.json geojson file which seems correctly formatted,Still it throws Invalid Json when i upload.
Could you please help?
Hello Devs,
Can anyone explain what  getNewRecord() on the force:recordData component, returns a Record object or a particular standard/Custom objects.
I have read the documentation which states below:
The doInit init handler calls getNewRecord() on the force:recordData component, passing in a simple callback handler. This call returns a Record object to create an empty contact record, which is used by the contact form in the component’s markup.
but on different scenario it returned different results although same markup and syntax used.
({
    onInit :function(component,event) {  
            component.find("service").getNewRecord( 
                "BoatReview__c", // sObject type (entityAPIName) 
                null,      // recordTypeId           
        		false,     // skip cache?           
            $A.getCallback(function() {
                    var rec = component.get("v.boatReview");
                    var error = component.get("v.recordError");
                    var boat=component.get("v.boat");               
                    if(error || (rec === null)) {                  
                    console.log("Error initializing record template: " + error);
                        return;
                    } else{ 
                        console.log("Record template initialized: " + rec.apiname);
                        //component.set("v.boatReviewRecord.Boat__c",boat.Id);                   
                        component.set("v.boatReview.Boat__c",boat.Id);
                    }
                    
            })        
        );
    }
})

Here rec.apiname returns undefined and when i used JSON.stringify(rec),it returns below result as it does not have apiName fieldIt misses apiname Field of record Objectwhile it returns contact when i execute similar code on Contact.code snippet below:
doInit: function(component, event, helper) {
    // Prepare a new record from template
    component.find("contactRecordCreator").getNewRecord(
    "Contact", // sObject type (objectApiName)
    null, // recordTypeId
    false, // skip cache?
    $A.getCallback(function() {
    var rec = component.get("v.newContact");
    var error = component.get("v.newContactError");
    if(error || (rec === null)) {
    console.log("Error initializing record template: " + error);
    return;
    }
    console.log("Record template initialized: " + rec.apiName);
It returns Contact as apiname See Result of JSON.Stringfy(rec)
It returns Ref of record object with APIname fields
    })
    );
}
Please let me know if Question is not clear or my understanding is wrong.
I am really scratching my head with this behavior.
Thanks in Advance.
 
Hi Experts,
I want to show only Custom error message "Please provide reason for Rejection"if Some user rejects an approval request and must provide comments,but it shows also validation error which i dont want to display and i am confused from where this error is thrown.
public class salesInvoiceRevenueSplitTriggerHandler{
    
    Public static void updateCommentsandDisplayError (List<Sales_Invoice_Revenue_Split__c> newSalesInvoiceRevenueList, Map<id, Sales_Invoice_Revenue_Split__c> oldMap){

    Map<Id, Sales_Invoice_Revenue_Split__c> rejectedStatements 
             = new Map<Id, Sales_Invoice_Revenue_Split__c>{};

  for(Sales_Invoice_Revenue_Split__c sirsObj: newSalesInvoiceRevenueList)
  {
    /* 
      Get the old object record, and check if the approval status 
      field has been updated to rejected. If so, put it in a map 
      so we only have to use 1 SOQL query to do all checks.
    */
    Sales_Invoice_Revenue_Split__c oldsirsObj = oldMap.get(sirsObj.Id);

    if (oldsirsObj .Margin_Approval_Status__c != 'Rejected' 
     && sirsObj.Margin_Approval_Status__c == 'Rejected')
    { 
      rejectedStatements.put(sirsObj.Id, sirsObj);  
    }
  }
   
  if (!rejectedStatements.isEmpty())  
  {
    // UPDATE 2/1/2014: Get the most recent approval process instance for the object.
    // If there are some approvals to be reviewed for approval, then
    // get the most recent process instance for each object.
    List<Id> processInstanceIds = new List<Id>{};
    
    for (Sales_Invoice_Revenue_Split__c invs : [SELECT (SELECT ID
                                              FROM ProcessInstances
                                              ORDER BY CreatedDate DESC
                                              LIMIT 1)
                                      FROM Sales_Invoice_Revenue_Split__c
                                      WHERE ID IN :rejectedStatements.keySet()])
    {
        processInstanceIds.add(invs.ProcessInstances[0].Id);
    }
      
    // Now that we have the most recent process instances, we can check
    // the most recent process steps for Comments.  
    for (ProcessInstance pi : [SELECT TargetObjectId,
                                   (SELECT Id, Comments  
                                    FROM Steps
                                    ORDER BY CreatedDate DESC
                                    LIMIT 1 )
                               FROM ProcessInstance
                               WHERE Id IN :processInstanceIds
                               ORDER BY CreatedDate DESC])   
    {                   
      if ((pi.Steps[0].Comments  == null || 
           pi.Steps[0].Comments .trim().length() == 0))
      { 
        rejectedStatements.get(pi.TargetObjectId).addError('Please provide Rejection Reason!');
   //pi.addError('Please provide Rejection Reason!');
      }
        else{rejectedStatements.get(pi.TargetObjectId).Comments__c=pi.Steps[0].Comments; 
          }
    }  
  }

    }

 



}
This method (updateCommentsandDisplayError) is called from Trigger on which approval process is written.
Please Suggest the possible Reason/Problem in my code.
Thanks
 
Hi All,
I have a Requirement where we want to track the user performance which is determined by the Days since Last ooportunityLineItemof specefic Type is added  by user   and suppose we track it by creating two fields on User Object 
1) Last Sensor Opp Created date(the day on which OppportunityProducts of specefic type is added to opportunity and 2)Days since sensor Opp Creation(Todays date- Last Sensor Opp Created date.
I have implemented it but in case of Deletion of Opportunity Line Items i want to roll Back to the previous value of Last Sensor Opp Created date.
Please suggest,i dont need code but any idea will help.
Thanks in Advance.
i am inserting Standard price book entry as well as Custom Price book entry for new Products (identified by Futurecodeset which contains productcodes for new Product)in my Batch apex  to call Method 1)insertSTDPBEntry(futurePCodeSet);and 2)insertCUSTOMPBEntry(futurePCodeSet);
//batch class
global class ProductBatchInsert implements Database.batchable<sobject>{
    global Map<String, Product2> pCodeToPMap = new Map<String, Product2>();
    global Map<String, Product2> existingProductCodeMap = new Map<String, Product2>(); // existing products from product codes uploaded by  file
    global List<Product2> newPList; // product list from csv for update (New)
    global List<Product2> oldPList; // product list from salesforce for update (Old)
    global List<Product2> insertPList; // product list to insert
    global List<Product2> insertPcloudList;//clouds products to be inserted
    global Set<String> futurePCodeSet; 
    global static Decimal exchangeRateUSDTOEUR = 0.0;
    global static Decimal exchangeRateUSDTOGBP = 0.0;
    global static Decimal exchangeRateUSDTOAED = 0.0;
    
    
    
    
    global ProductBatchInsert(){}
    
    global Database.QueryLocator start(Database.BatchableContext BC) {
        // collect the batches of records or objects to be passed to execute
         
        String query = 'SELECT ID,Item_Category_ID__c,Contract_Price__c,DiscountCategory__c,Brand__c,Item_Category_Name__c,Manufacturer_Part_Number__c,Manufacturer__c,MSRP__c,Name,Part_Description__c,Sender_ID__c,Technology__c,Vendor_Part_Number__c FROM Oracle201815__c';
        return Database.getQueryLocator(query);
    }
    global void execute(Database.BatchableContext batchableContext, List<Oracle201815__c> scope){ 
        Product2 p2Obj = new Product2();
        for(Oracle201815__c ProductFileIndividualRec : scope){
            if(ProductFileIndividualRec.Manufacturer_Part_Number__c!=null){
            	List<String> customFieldset = new List<String>();
                p2Obj = new Product2();
                p2Obj.isActive = true; 
                p2Obj.ProductCode = ProductFileIndividualRec.Manufacturer_Part_Number__c;
                p2Obj.Name = ProductFileIndividualRec.Part_Description__c;
                p2Obj.Category__c=ProductFileIndividualRec.Item_Category_Name__c;               
                p2Obj.Description=ProductFileIndividualRec.Part_Description__c;               
                p2Obj.List_Price__c=ProductFileIndividualRec.MSRP__c;               
                p2Obj.Product_Manufacturer__c=ProductFileIndividualRec.Manufacturer__c;
              
               	customFieldset = CintraUtil.DecideCustomFields(ProductFileIndividualRec.Part_Description__c,ProductFileIndividualRec.Item_Category_Name__c);//method to determine the cintra category and Revenue type and skip the cloud realted products
                    if(customFieldset!=null && customFieldset.size()>0){
                    	 System.debug('customFieldsetnotnull'+customFieldset); 
                        p2Obj.Cintra_Category__c=customFieldset.get(1);
                        System.debug('CintraCategoryDecisionResult'+customFieldset.get(1));
                        p2Obj.Family=customFieldset.get(0);
                        System.debug('CintrafamilyDecisionResult'+customFieldset.get(0));
                        p2Obj.Product_Family_Group__c = 'Resell';
                     }
                     else{
                     	 System.debug('customFieldsetnull');
                     	p2Obj.Cintra_Category__c='NA';
                        p2Obj.Family='NA';
                        p2Obj.Product_Family_Group__c='NA';
                     }
                //System.debug('customFieldsetvalues'+customFieldset);
                pCodeToPMap.put(ProductFileIndividualRec.Manufacturer_Part_Number__c,p2Obj);
                
                
    			}
				}
        
        System.debug('pCodeToPMaplist'+pCodeToPMap.size());
        if(pCodeToPMap != null && pCodeToPMap.size() > 0){
            System.debug('before insertingexistingproductmap00001'+pCodeToPMap.keyset());
            //List<String> pCodeSet =new List<String>(pCodeToPMap.keyset());
            //System.debug('listofproductcodes***'+pCodeSet);
            /*for(String st : pCodeToPMap.keyset() ){
               pCodeSet.add('\'+st+'"') ;
            }*/
         for(PricebookEntry  pricebookEntryObj : [SELECT Product2Id,Product2.ChangeLog__c,Product2.IsActive,Product2.ProductCode,Product2.Name,Product2.Category__c,Product2.Description,Product2.List_Price__c,Product2.Product_Manufacturer__c,Product2.Revenue_Type__c,Product2.Artesian_Comment__c,Product2.Cintra_Category__c,Product2.Family,Product2.Product_Family_Group__c FROM PricebookEntry WHERE ((Product2.ProductCode IN : pCodeToPMap.keyset()) and (CurrencyIsoCode ='USD') and (Pricebook2.name = 'Cintra Master Pricebook 2017 - 2018'))]){
               System.debug('before insertingexistingproductmap0000');
             if(pricebookEntryObj.Product2.ProductCode != null){
                    System.debug('before insertingexistingproductmap0');
                    Product2 pObj1 = new product2();
                        pObj1.Id=pricebookEntryObj.Product2Id;
                           pObj1.IsActive=pricebookEntryObj.Product2.IsActive; 
                           pObj1.ProductCode=pricebookEntryObj.Product2.ProductCode;
                           pObj1.Name=pricebookEntryObj.Product2.Name;
                           pObj1.Category__c=pricebookEntryObj.Product2.Category__c;
                           pObj1.Description=pricebookEntryObj.Product2.Description;
                           pObj1.List_Price__c=pricebookEntryObj.Product2.List_Price__c;
                           pObj1.Product_Manufacturer__c=pricebookEntryObj.Product2.Product_Manufacturer__c;
                 		   pObj1.ChangeLog__c=pricebookEntryObj.Product2.ChangeLog__c;
                          // pObj1.Revenue_Type__c=pricebookEntryObj.Product2.Revenue_Type__c;
                           pObj1.Artesian_Comment__c=pricebookEntryObj.Product2.Artesian_Comment__c;
                           pObj1.Cintra_Category__c=pricebookEntryObj.Product2.Cintra_Category__c;
                           pObj1.Family=pricebookEntryObj.Product2.Family;
                           pObj1.Product_Family_Group__c =pricebookEntryObj.Product2.Product_Family_Group__c;
             		System.debug('before insertingexistingproductmap1');
                    existingProductCodeMap.put(pricebookEntryObj.Product2.ProductCode, pObj1);
                    System.debug('before insertingexistingproductmap2');
                    System.debug('existingProductCodeMap'+existingProductCodeMap.values());
               	 }    
            }
            newPList = new List<Product2>();
            oldPList = new List<Product2>();
            insertPList = new List<Product2>();//contains new Product List for insert
            insertPcloudList = new List<Product2>();//contains new cloudProduct List for insert
            futurePCodeSet = new Set<String>();
            
           for(String Pcode : pCodeToPMap.keySet()){
               System.debug('pCodeToPMapsizecheck'+pCodeToPMap.size());
                if(existingProductCodeMap.keySet().contains(PCode)){
                    oldPList.add(existingProductCodeMap.get(PCode));
                    newPList.add(pCodeToPMap.get(PCode));
                    //System.debug('newProductList'+newPList);
                     System.debug('oldPList****'+oldPList);
                     System.debug('newPList******'+newPList);
                    
                }else{
                    if(pCodeToPMap.get(PCode).Family!='NA'){//excluding products whose product family is NA means non cloud products
                    insertPList.add(pCodeToPMap.get(PCode));
                    System.debug('insertproductlist****()'+insertPList);
                     futurePCodeSet.add(PCode);
                      System.debug('futurePCodeSet****()'+futurePCodeSet);
                    }//product codes to create StdPBEntry and CustomPBEntry
                    else{
                    	insertPcloudList.add(pCodeToPMap.get(PCode));
                    	//System.debug('cloudlistsize****'+insertPcloudList.size());
                    }
                    
                }
                
                
            }for(Product2 pcloud:insertPcloudList){
            	System.debug('cloudlistsize****'+pcloud.ProductCode);
            }
            //System.debug('cloudlistsize****'+insertPcloudList);
            System.debug('new products in file******'+insertPList);
            
            if(insertPList != null && insertPList.size() > 0){
                System.debug('insertplistsize****'+insertPList.size());
                insert insertPList;
                insertPList.clear();
                insertSTDPBEntry(futurePCodeSet);
                insertCUSTOMPBEntry(futurePCodeSet);
                
            }
            if(oldPList != null && oldPList.size() > 0){
                System.debug('productswithchangesize****'+oldPList.size());
                System.debug('productswithchange****'+oldPList);
                compareAndUpdateProducts();
            }
   	 	}
    }
    
           

        
    
    global void finish(Database.BatchableContext BC){
            // Add batch job calling logic in Finish method
		   // ProductInactivationBatchClass b = new ProductInactivationBatchClass(); 
			//database.executebatch(b);
  }
     public static void insertSTDPBEntry(Set<String> futurePCodeSet){
        String pricebookId = null;
        if(futurePCodeSet!= null && futurePCodeSet.size()>0){
            List<Pricebook2> pbList = [select Id, Name, IsActive from PriceBook2 where IsStandard=True LIMIT 1]; 
            if(pbList != null && pbList.size()>0){
                pricebookId = pbList[0].Id;
            }
            if(pricebookId != null){
                PricebookEntry pbeObj;
                List<PricebookEntry> pbeList = new List<PricebookEntry>();
                exchangeRateUSDTOEUR = 0.0;
                  exchangeRateUSDTOGBP = 0.0;
                  exchangeRateUSDTOAED = 0.0;
                
                try{
                    CintraOtherSettingsCS__c cosObj = CintraOtherSettingsCS__c.getValues('Oracle_Exchange_Rate_USD_TO_EUR');
                    exchangeRateUSDTOEUR = Decimal.valueOf(cosObj.value__c);
                    System.debug('exchangeRateUSDTOEUR***'+exchangeRateUSDTOEUR);
                    CintraOtherSettingsCS__c cosObj1 = CintraOtherSettingsCS__c.getValues('Oracle_Exchange_Rate_USD_TO_GBP');
                    exchangeRateUSDTOGBP = Decimal.valueOf(cosObj1.value__c);
                    System.debug('exchangeRateUSDTOGBP***'+exchangeRateUSDTOGBP);
                    CintraOtherSettingsCS__c cosObj2 = CintraOtherSettingsCS__c.getValues('Oracle_Exchange_Rate_USD_TO_AED');
                    exchangeRateUSDTOAED = Decimal.valueOf(cosObj2.value__c);
                }catch(Exception e){
                  exchangeRateUSDTOEUR = 0.8;
                  exchangeRateUSDTOGBP = 0.8;
                  exchangeRateUSDTOAED = 0.8;
                }
                for(Product2 pObj : [SELECT Id, ProductCode, List_Price__c, CurrencyIsoCode FROM Product2 WHERE ProductCode IN : futurePCodeSet]){
                    pbeObj = new PriceBookEntry();
                    pbeObj.Product2ID = pObj.Id;
                    pbeObj.PriceBook2ID = pricebookId;
                    pbeObj.CurrencyIsoCode = pObj.CurrencyIsoCode;
                    pbeObj.UnitPrice = (pObj.List_Price__c != null) ? pObj.List_Price__c : 0.0;
                    pbeObj.IsActive = true;
                    pbeList.add(pbeObj);
                    
                    pbeObj = new PriceBookEntry();
                    pbeObj.Product2ID = pObj.Id;
                    pbeObj.PriceBook2ID = pricebookId;
                    pbeObj.CurrencyIsoCode = 'GBP';
                    pbeObj.UnitPrice = (pObj.List_Price__c != null) ? (pObj.List_Price__c * exchangeRateUSDTOGBP) : 0.0;
                    pbeObj.IsActive = true;
                    pbeList.add(pbeObj);
                    
                    pbeObj = new PriceBookEntry();
                    pbeObj.Product2ID = pObj.Id;
                    pbeObj.PriceBook2ID = pricebookId;
                    pbeObj.CurrencyIsoCode = 'EUR';
                    pbeObj.UnitPrice = (pObj.List_Price__c != null) ? (pObj.List_Price__c * exchangeRateUSDTOEUR) : 0.0;
                    pbeObj.IsActive = true;
                    pbeList.add(pbeObj);
                    
                    pbeObj = new PriceBookEntry();
                    pbeObj.Product2ID = pObj.Id;
                    pbeObj.PriceBook2ID = pricebookId;
                    pbeObj.CurrencyIsoCode = 'AED';
                    pbeObj.UnitPrice = (pObj.List_Price__c != null) ? (pObj.List_Price__c * exchangeRateUSDTOAED) : 0.0;
                    pbeObj.IsActive = true;
                    pbeList.add(pbeObj);
                }
                if(pbeList != null && pbeList.size() > 0){
                    insert pbeList;
                }
            }
        }
    }
    
    public static void insertCUSTOMPBEntry(Set<String> futurePCodeSet){
        String pricebookId = null;
        //pricebookId = Label.Active_Pricebook;//create one custom label which contains the id for Custom Pricebook
        if(futurePCodeSet!= null && futurePCodeSet.size()>0){
            List<Pricebook2> pbList = [select Id, Name, IsActive from PriceBook2 where NAME ='Cintra Master Pricebook 2017 - 2018']; 
            if(pbList != null && pbList.size()>0){
                pricebookId = pbList[0].Id;
            }
            if(pricebookId != null){
                PricebookEntry pbeObj;
                List<PricebookEntry> pbeList = new List<PricebookEntry>();
                exchangeRateUSDTOEUR = 0.0;
                  exchangeRateUSDTOGBP = 0.0;
                  exchangeRateUSDTOAED = 0.0;
                
                try{
                    CintraOtherSettingsCS__c cosObj = CintraOtherSettingsCS__c.getValues('Oracle_Exchange_Rate_USD_TO_EUR');
                    exchangeRateUSDTOEUR = Decimal.valueOf(cosObj.value__c);
                    system.debug('checkingcustomsettingvalues1'+exchangeRateUSDTOEUR);
                    CintraOtherSettingsCS__c cosObj1 = CintraOtherSettingsCS__c.getValues('Oracle_Exchange_Rate_USD_TO_GBP');
                    exchangeRateUSDTOGBP = Decimal.valueOf(cosObj1.value__c);
                    system.debug('checkingcustomsettingvalues2'+exchangeRateUSDTOGBP);
                    CintraOtherSettingsCS__c cosObj2 = CintraOtherSettingsCS__c.getValues('Oracle_Exchange_Rate_USD_TO_AED');
                    exchangeRateUSDTOAED = Decimal.valueOf(cosObj2.value__c);
                }catch(Exception e){
                  
                 	 exchangeRateUSDTOGBP = 0.8;
                     exchangeRateUSDTOEUR = 0.8;
                  	exchangeRateUSDTOAED = 0.8;
                }
                for(Product2 pObj : [SELECT Id, ProductCode, List_Price__c, CurrencyIsoCode FROM Product2 WHERE ProductCode IN : futurePCodeSet]){
                    pbeObj = new PriceBookEntry();
                    pbeObj.Product2ID = pObj.Id;
                    pbeObj.PriceBook2ID = pricebookId;
                    pbeObj.CurrencyIsoCode = pObj.CurrencyIsoCode;
                    pbeObj.UnitPrice = (pObj.List_Price__c != null) ? pObj.List_Price__c : 0.0;
                    pbeObj.IsActive = true;
                    pbeList.add(pbeObj);
                    
                    pbeObj = new PriceBookEntry();
                    pbeObj.Product2ID = pObj.Id;
                    pbeObj.PriceBook2ID = pricebookId;
                    pbeObj.CurrencyIsoCode = 'GBP';
                    pbeObj.UnitPrice = (pObj.List_Price__c != null) ? (pObj.List_Price__c * exchangeRateUSDTOGBP) : 0.0;
                    pbeObj.IsActive = true;
                    pbeList.add(pbeObj);
                    
                    pbeObj = new PriceBookEntry();
                    pbeObj.Product2ID = pObj.Id;
                    pbeObj.PriceBook2ID = pricebookId;
                    pbeObj.CurrencyIsoCode = 'EUR';
                    pbeObj.UnitPrice = (pObj.List_Price__c != null) ? (pObj.List_Price__c * exchangeRateUSDTOEUR) : 0.0;
                    pbeObj.IsActive = true;
                    pbeList.add(pbeObj);
                    
                    pbeObj = new PriceBookEntry();
                    pbeObj.Product2ID = pObj.Id;
                    pbeObj.PriceBook2ID = pricebookId;
                    pbeObj.CurrencyIsoCode = 'AED';
                    pbeObj.UnitPrice = (pObj.List_Price__c != null) ? (pObj.List_Price__c * exchangeRateUSDTOAED) : 0.0;
                    pbeObj.IsActive = true;
                    pbeList.add(pbeObj);
                }
                if(pbeList != null && pbeList.size() > 0){
                    insert pbeList;
                }
            }
        }
    }
      private void compareAndUpdateProducts(){
        exchangeRateUSDTOEUR = 0.0;
        exchangeRateUSDTOGBP = 0.0;
        exchangeRateUSDTOAED = 0.0;
        try{
            /*if(test.isRunningTest()){
                exchangeRateUSDTOGBP = 0.8;
                exchangeRateUSDTOEUR = 0.8;
                exchangeRateUSDTOAED = 0.8;}*/
        	CintraOtherSettingsCS__c cosObj = CintraOtherSettingsCS__c.getValues('Oracle_Exchange_Rate_USD_TO_EUR');
            exchangeRateUSDTOEUR = Decimal.valueOf(cosObj.value__c);
            system.debug('checkingcustomsettingvalues1'+exchangeRateUSDTOEUR);
            CintraOtherSettingsCS__c cosObj1 = CintraOtherSettingsCS__c.getValues('Oracle_Exchange_Rate_USD_TO_GBP');
            exchangeRateUSDTOGBP = Decimal.valueOf(cosObj1.value__c);
            system.debug('checkingcustomsettingvalues2'+exchangeRateUSDTOGBP);
            CintraOtherSettingsCS__c cosObj2 = CintraOtherSettingsCS__c.getValues('Oracle_Exchange_Rate_USD_TO_AED');
            exchangeRateUSDTOAED = Decimal.valueOf(cosObj2.value__c);
             
        }
        catch(Exception e){
     	 exchangeRateUSDTOGBP = 0.8;
         exchangeRateUSDTOEUR = 0.8;
      	exchangeRateUSDTOAED = 0.8;
        }
        List<Product2> updatePList = new List<Product2>();
        Map<Id, Decimal> pIdToPriceMap = new Map<Id, Decimal>();
        List<PricebookEntry> pCodeToPMap = new List<PricebookEntry>();
        Boolean isUpdate;
        Boolean isPricebookUpdate;
         
        for(Integer i=0; i<oldPList.size(); i++){
            isUpdate = false;
            isPricebookUpdate = false;
            String Changelog=(oldPList[i].ChangeLog__c!=null)?oldPList[i].ChangeLog__c:'';
           
            if(newPList[i].isActive != oldPList[i].isActive){
                Changelog+='Product'+oldPList[i].ProductCode+'changed from'+oldPList[i].isActive+'to'+newPList[i].isActive+'\r\n';
                oldPList[i].isActive = newPList[i].isActive;
                isUpdate = true;
                
            }
            if(newPList[i].Name != null && newPList[i].Name != oldPList[i].Name){
                Changelog+='Product'+oldPList[i].ProductCode+'Name changed from'+oldPList[i].Name+'to'+newPList[i].Name+'\r\n';
                oldPList[i].Name = newPList[i].Name;
                isUpdate = true;
                
            }
            if(newPList[i].List_Price__c != null && newPList[i].List_Price__c != oldPList[i].List_Price__c){
                Changelog+='Product'+oldPList[i].ProductCode+'List price changed from'+oldPList[i].List_Price__c+'to'+newPList[i].List_Price__c+'\r\n';
                oldPList[i].List_Price__c = newPList[i].List_Price__c;
                isUpdate = true;
                isPricebookUpdate = true;
            }
            if(newPList[i].Family != null && newPList[i].Family != oldPList[i].Family){
                 Changelog+='Product'+oldPList[i].ProductCode+'Family changed from'+oldPList[i].Family+'to'+newPList[i].Family+'\r\n';
                oldPList[i].Family = newPList[i].Family;
                isUpdate = true;
            }
            if(newPList[i].Description != null && newPList[i].Description != oldPList[i].Description){
                 Changelog+='Product'+oldPList[i].ProductCode+'Description changed from'+oldPList[i].Description+'to'+newPList[i].Description+'\r\n';
                oldPList[i].Description = newPList[i].Description;
                isUpdate = true;
            }
           if(newPList[i].Category__c !=null && newPList[i].Category__c != oldPList[i].Category__c ) {
               if( !(newPList[i].Category__c).containsIgnoreCase('cloud')){
                    Changelog+='Product'+oldPList[i].ProductCode+'Category changed from'+oldPList[i].Category__c+'to'+newPList[i].Category__c+'\r\n';
                oldPList[i].Category__c = newPList[i].Category__c;
                oldPList[i].Cintra_Category__c=newPList[i].Cintra_Category__c;
               oldPList[i].Family=newPList[i].Family;
                isUpdate = true;
                   }
            }
            if(isUpdate){
                //Changelog+='on'+System.now();
                oldPlist[i].ChangeLog__c='['+System.now()+']'+'--'+Changelog;
                updatePList.add(oldPList[i]);
                System.debug('updatePlist***'+updatePList);
            }
            if(isPricebookUpdate){
                pIdToPriceMap.put(oldPList[i].Id, newPList[i].List_Price__c);
            }
        }
        if(updatePList != null && updatePList.size() > 0){
            update updatePList;
        }
        List<PricebookEntry> updatePBEList = new List<PricebookEntry>();
        for(PricebookEntry pbeObj : [SELECT Id, UnitPrice, CurrencyIsoCode, Product2Id FROM PricebookEntry WHERE Product2Id IN : pIdToPriceMap.keySet()]){
            if(pbeObj.CurrencyIsoCode == 'USD'){
                pbeObj.UnitPrice = pIdToPriceMap.get(pbeObj.Product2Id);
            }else if(pbeObj.CurrencyIsoCode == 'GBP'){
                pbeObj.UnitPrice = pIdToPriceMap.get(pbeObj.Product2Id) * exchangeRateUSDTOGBP;
            }else if(pbeObj.CurrencyIsoCode == 'AED'){
                pbeObj.UnitPrice = pIdToPriceMap.get(pbeObj.Product2Id) * exchangeRateUSDTOAED;
            }else if(pbeObj.CurrencyIsoCode == 'EUR'){
                pbeObj.UnitPrice = pIdToPriceMap.get(pbeObj.Product2Id) * exchangeRateUSDTOEUR;
            }
            updatePBEList.add(pbeObj);
        }
        if(updatePBEList != null && updatePBEList.size() > 0){
            update updatePBEList;
        }
    }
    
   
  
    
    
}
//test class for Batch class
@isTest
public class ProductBatchInserttest 
{
   @isTest(seeAllData=false)
    static  void testMethod1() 
    {
        List<Oracle201815__c> lstOraclefile= new List<Oracle201815__c>();
       // List<Product2> prdObj = new List<Product2>();
      /*  List<PricebookEntry> pbeList = new List<PricebookEntry>();
       CintraOtherSettingsCS__c cosObj = new CintraOtherSettingsCS__c(Name='Oracle_Exchange_Rate_USD_TO_EUR', Value__c = '1');
      insert cosObj;
        CintraOtherSettingsCS__c cosObj1 = new CintraOtherSettingsCS__c(Name='Oracle_Exchange_Rate_USD_TO_GBP', Value__c = '0.8');
      insert cosObj1;
        CintraOtherSettingsCS__c cosObj2 = new CintraOtherSettingsCS__c(Name='Oracle_Exchange_Rate_USD_TO_AED', Value__c = '0.6');
      insert cosObj2;*/
      
        Product2 pObj = new Product2 (Name='Test Product Entry 1',Description='Test Product Entry 1',productCode = 'Name10', isActive = true);
       insert(pObj);
        //standard PBEntry
       Id pricebookId = Test.getStandardPricebookId(); 
        PricebookEntry standardPrice = new PricebookEntry(
            Pricebook2Id = pricebookId, Product2Id = pObj.Id,CurrencyIsoCode = 'USD',
            UnitPrice = 10000, IsActive = true);
        insert standardPrice;
        PricebookEntry standardPrice1 = new PricebookEntry(
            Pricebook2Id = pricebookId, Product2Id = pObj.Id,CurrencyIsoCode = 'GBP',
            UnitPrice = 10000, IsActive = true);
        insert standardPrice1;
        PricebookEntry standardPrice2 = new PricebookEntry(
            Pricebook2Id = pricebookId, Product2Id = pObj.Id,CurrencyIsoCode = 'AED',
            UnitPrice = 10000, IsActive = true);
        insert standardPrice2;
        PricebookEntry standardPrice3 = new PricebookEntry(
            Pricebook2Id = pricebookId, Product2Id = pObj.Id,CurrencyIsoCode = 'EUR',
            UnitPrice = 10000, IsActive = true);
        insert standardPrice3;
   
      
        //CustomPBentry
        Pricebook2 customPB = new Pricebook2(Name='Cintra Master Pricebook 2017 - 2018', isActive=true);
        insert customPB;
        
        // 2. Insert a price book entry with a custom price.
       	 PricebookEntry customPBEUSD = new PricebookEntry(Pricebook2Id = customPB.Id, Product2Id = pObj.Id,UnitPrice = 12000,CurrencyIsoCode = 'USD', IsActive = true);
        insert customPBEUSD;
        PricebookEntry customPBEGBP = new PricebookEntry(Pricebook2Id = customPB.Id, Product2Id = pObj.Id,UnitPrice = 12000,CurrencyIsoCode = 'GBP', IsActive = true);
        insert customPBEGBP;
        PricebookEntry customPBEEUR = new PricebookEntry(Pricebook2Id = customPB.Id, Product2Id = pObj.Id,UnitPrice = 12000,CurrencyIsoCode = 'EUR', IsActive = true);
        insert customPBEEUR;
        PricebookEntry customPBEAED = new PricebookEntry(Pricebook2Id = customPB.Id, Product2Id = pObj.Id,UnitPrice = 12000,CurrencyIsoCode = 'AED', IsActive = true);
        insert customPBEAED;
        
        
        
        
        
        for(Integer i=0 ;i <100;i++)//for non cloud Products
        {
            Oracle201815__c oracleRec = new Oracle201815__c();
           
              	oracleRec.Manufacturer_Part_Number__c='CODE'+i;
                oracleRec.Part_Description__c='Name'+i;
                oracleRec.Item_Category_Name__c='HW'+i;               
                oracleRec.Part_Description__c='Name'+i;               
             	oracleRec.MSRP__c=i;              
                oracleRec.Manufacturer__c='oracle';
            lstOraclefile.add(oracleRec);
        }
        for(Integer i=0 ;i <100;i++)//for cloud products
        {
            Oracle201815__c oracleRec = new Oracle201815__c();
           
              oracleRec.Manufacturer_Part_Number__c='Name1'+i;
                oracleRec.Part_Description__c='Name1'+i;
                oracleRec.Item_Category_Name__c='Cloud'+i;               
                oracleRec.Part_Description__c='Name1'+i;               
              oracleRec.MSRP__c=i;              
                oracleRec.Manufacturer__c='oracle';
            lstOraclefile.add(oracleRec);
        }
        Oracle201815__c oracleRec = new Oracle201815__c();
           
              	oracleRec.Manufacturer_Part_Number__c = 'PROD1000';
                oracleRec.Part_Description__c='Name1';
                oracleRec.Item_Category_Name__c='SW';               
                oracleRec.Part_Description__c='Name1';               
              	oracleRec.MSRP__c=100;              
                oracleRec.Manufacturer__c='oracle';
        		
        
            lstOraclefile.add(oracleRec);
        
        insert lstOraclefile;
        
        Test.startTest();

            ProductBatchInsert obj = new ProductBatchInsert();
           ID BatchId =DataBase.executeBatch(obj,2000); 
        //System.abortJob(batchID);
            
        Test.stopTest();
    }
}

 
I have seen many codes where actionfunction is used and it is called from javascript ,why we require javascript if we can call the controller method on click of command buttons..
i have written one trigger to insert a new Account species/consultation record  (ZTS_EU_Account_Species_Potential__c) if species name matches the species listed in my custom setting (SpeciesList__c) which has three fields parentspeciesname,childspeciesname  and one factor (number field).but my insert statement fails and throws the mentioned error ,i am stuck with this error for previous 24 hrs ,any help would be appreciated.here species is a different object (ZTS_EU_Species__c ) and lookup field of Account consultation records.
here is my trigger:
trigger createChildSpecies on ZTS_EU_Account_Species_Potential__c (before Insert) {
    ID accctid;
    ID Speciesid;
    ID childspeciesid;
    String Speciesname;
    Double Parentcount;
    String CHLDSpeciesname;
    String myCCVal ;
    ZTS_EU_Species__c test=new ZTS_EU_Species__c ();
    ZTS_EU_Species__c childtestforid=new ZTS_EU_Species__c ();
    
    
    
    ZTS_EU_Account_Species_Potential__c PARENTRECORD;
    ZTS_EU_Account_Species_Potential__c chld=new ZTS_EU_Account_Species_Potential__c();
    for(ZTS_EU_Account_Species_Potential__c a:trigger.new)
    {
        //PARENTRECORD.Account__c=a.Account__c;
        Speciesid=a.ZTS_EU_Species_Potential__c;
        system.debug('parentspeciesnameeee===='+Speciesid);
        test=[SELECT Name FROM ZTS_EU_Species__c WHERE ZTS_EU_Market__c = 'Spain' AND Id =:Speciesid];
        Speciesname=test.Name ;
        system.debug('speciesname===='+Speciesname);
        Map<String, SpeciesList__c> mapStatusCodeCustomSetting = SpeciesList__c.getAll();
        for(SpeciesList__c mandatoryRoles : mapStatusCodeCustomSetting.values()){
            if (mandatoryRoles .ParentSpeciesName__c==Speciesname)
            {
                myCCVal = mandatoryRoles .ChildSpeciesName__c;
                childtestforid=[SELECT Id FROM ZTS_EU_Species__c WHERE ZTS_EU_Market__c = 'Spain' AND Name =:myCCVal ];
                system.debug('myCS1 ===='+myCCVal);
                
            }
        }
            
            
            
            chld.Account__c=a.Account__c;         
            childspeciesid=childtestforid.Id;
            system.debug('childspeciesid===='+childtestforid);
            chld.ZTS_EU_Species_Potential__c=childspeciesid;
            chld.ZTS_EU_Animal_Consultations_new__c=10;
            insert(chld);
    }
    
}

 
Hi All,i have a vf page which is renderas pdf ,but while generating pdf,it looses some columns,i tried landscape orientation by which 14 columns are fitted ,Need help to accomodate more columns in pdf,its 
<!-- vf page -->
<apex:page standardController="Order_vod__c" extensions="AGN_OrderController" sidebar="false"  wizard="True" showHeader="false" title="Order PDF" renderAs="pdf" applyBodyTag="false " standardStylesheets="false">
    <!--<style type="text/css">
   .outBorder {
    border:1px outset black;
   }
   .inBorder{
    border-top:1px dotted blue;
    border-left:1px dotted blue;
   }
   .element {
  font-size: 1em;
}
  </style> -->
    <head>
        
    
    <style>
@page {
size: landscape;
        margin: 0.002mm; 
        white-space: normal;
        font-size: 1px;
        

}
</style>
        </head>
  <!--<apex:stylesheet value="{!URLFOR($Resource.testing_css, 'styles.css')}" />-->
    <head>
        
    </head>
    
    <body>
        <h1>
            Hello World
        </h1>
        <apex:dataTable value="{!ORDERSLIST}" var="olist" cellPadding="4" border="1"  >
            
          <apex:column >
               
           <apex:facet name="header">Account Name</apex:facet>
              
                <apex:outputField value="{!olist.Account_vod__r.Name}" />
            </apex:column>
             <apex:column >
                <apex:facet name="header">External ID</apex:facet>
                <apex:outputField value="{!olist.Account_vod__r.External_ID4_AGN__c}" />
            </apex:column>
             <apex:column >
                <apex:facet name="header" >Billing Contact</apex:facet>
                <apex:outputField value="{!olist.Billing_Contact_vod__c}"  />
            </apex:column>
             <apex:column >
                <apex:facet name="header" >Billing Address_</apex:facet>
                <apex:outputField value="{!olist.Billing_Address_Line_1_vod__c}" />
                  <apex:outputField value="{!olist.Billing_Address_Line_2_vod__c}" />
            </apex:column> 
            <apex:column >
                <apex:facet name="header">Ship To Address</apex:facet>
                <apex:outputField value="{!olist.Ship_To_Address_vod__r.Name}" />
            </apex:column>
             <apex:column >
                <apex:facet name="header">Notes</apex:facet>
                <apex:outputField value="{!olist.Notes_vod__c}"/>
            </apex:column>
            <!--  </apex:dataTable>-->
        <br/>
       <!-- <apex:dataTable value="{!ORDERSLIST}" var="olist" cellPadding="4" border="1"  >-->
             <apex:column >
                <apex:facet name="header">Order Date</apex:facet>
                <apex:outputField value="{!olist.Order_Date_vod__c}" />
            </apex:column>
            
             <apex:column >
                <apex:facet name="header">Quantity</apex:facet>
                <apex:outputField value="{!olist.Order_Total_Quantity_vod__c}"/>
            </apex:column>
              <apex:column >
                <apex:facet name="header">List Amount</apex:facet>
                <apex:outputField value="{!olist.Order_List_Amount_vod__c}"/>
            </apex:column>
            
          
              <apex:column >
                <apex:facet name="header">Total Discount</apex:facet>
                <apex:outputField value="{!olist.Order_Total_Discount_vod__c}" />
            </apex:column>
              <apex:column >
                <apex:facet name="header">Net Amount</apex:facet>
                <apex:outputField value="{!olist.Order_Net_Amount_vod__c}" />
            </apex:column>
            
           
             <apex:column >
                <apex:facet name="header">Delivery Date</apex:facet>
                <apex:outputField value="{!olist.Delivery_Date_vod__c}"  />
            </apex:column>
            
               </apex:dataTable>
    
        <br/>
        
        
        <apex:dataTable value="{!ORDERLINES}" var="order" cellPadding="4" border="1">
          
            <apex:column >
                <apex:facet name="header">Product</apex:facet>
                <apex:outputField value="{!order.Product_vod__r.Name}" />
            </apex:column>
            <apex:column >
                <apex:facet name="header">Quantity</apex:facet>
                <apex:outputField value="{!order.Quantity_vod__c}" />
            </apex:column>
             <apex:column >
                <apex:facet name="header">List Price Rule</apex:facet>
                <apex:outputField value="{!order.List_Price_Rule_vod__c}" />
            </apex:column>
             <apex:column >
                <apex:facet name="header">Line Discount</apex:facet>
                <apex:outputField value="{!order.Line_Discount_vod__c}" />
            </apex:column>
             <apex:column >
                <apex:facet name="header">Free Goods</apex:facet>
                <apex:outputField value="{!order.Free_Goods_vod__c}" />
            </apex:column> 
            <apex:column >
                <apex:facet name="header">List Amount</apex:facet>
                <apex:outputField value="{!order.List_Amount_vod__c}" />
            </apex:column>
            <apex:column >
                <apex:facet name="header">Net Price</apex:facet>
                <apex:outputField value="{!order.Net_Price_vod__c}" />
            </apex:column>
             <apex:column >
                <apex:facet name="header">Net Amount</apex:facet>
                <apex:outputField value="{!order.Net_Amount_vod__c}" />
            </apex:column>
          <!--   </apex:dataTable> -->
        <br/>
      <!--   <apex:dataTable value="{!ORDERLINES}" var="order" cellPadding="4" border="1">-->
       <apex:column >
                <apex:facet name="header">Rule</apex:facet>
                <apex:outputField value="{!order.Rule_vod__c}" />
            </apex:column>
             <apex:column >
                <apex:facet name="header">Brand Discount Rule</apex:facet>
                <apex:outputField value="{!order.Brand_Discount_Rule_vod__c}" />
            </apex:column>
              <apex:column >
                <apex:facet name="header">Group Discount Rule</apex:facet>
                <apex:outputField value="{!order.Group_Discount_Rule_vod__c}" />
            </apex:column>
             <apex:column >
                <apex:facet name="header">Free Goods Rule</apex:facet>
                <apex:outputField value="{!order.Free_Goods_Rule_vod__c}" />
            </apex:column>
            <apex:column >
                <apex:facet name="header">List Price (VAT)</apex:facet>
                <apex:outputField value="{!order.KR_List_Price_VAT_AGN__c}" />
            </apex:column>
             <apex:column >
                <apex:facet name="header">Net Amount (VAT)</apex:facet>
                <apex:outputField value="{!order.KR_Net_Amount_VAT_AGN__c}" />
            </apex:column>
             <apex:column >
                <apex:facet name="header">Customer Price</apex:facet>
                <apex:outputField value="{!order.KR_Customer_Price_AGN__c}" />
            </apex:column>
            
        </apex:dataTable>
    </body>    
</apex:page>
 
Controller:
public  class AGN_OrderController
{

    public AGN_OrderController() {

    }

    public string orderrId{get;set;}
    PUBLIC string name{get;set;}
    
    public AGN_OrderController(ApexPages.StandardController stdController){
        orderrId = ApexPages.currentPage().getParameters().get('id');
    }
    
    public  List<Order_vod__c> getORDERSLIST()
    {
        List<Order_vod__c> ORDERSLIST ;
        
        ORDERSLIST = [SELECT Account_vod__r.Name,Account_vod__r.RecordType.name,Account_vod__r.External_ID4_AGN__c,Billing_Contact_vod__c,Billing_Address_Line_1_vod__c,Billing_Address_Line_2_vod__c,Ship_To_Address_vod__r.Name,Notes_vod__c,Order_Date_vod__c,Order_Total_Quantity_vod__c,Order_List_Amount_vod__c,Order_Total_Discount_vod__c,Order_Net_Amount_vod__c,Delivery_Date_vod__c FROM Order_vod__c WHERE Id=: orderrId ];
        List<Order_vod__c> n=[SELECT Notes_vod__c from Order_vod__c];
      
         
        
        system.debug('Order'+ORDERSLIST);
       
        return ORDERSLIST;
       
    }
    
    public  List<Order_Line_vod__c> getORDERLINES()
    {
        List<Order_Line_vod__c> ORDERLINES ;
        
        ORDERLINES= [SELECT Product_vod__r.Name,Quantity_vod__c,List_Price_Rule_vod__c,Line_Discount_vod__c,Free_Goods_vod__c,List_Amount_vod__c,Net_Price_vod__c,Net_Amount_vod__c,Rule_vod__c,Brand_Discount_Rule_vod__c,Group_Discount_Rule_vod__c,Free_Goods_Rule_vod__c,KR_Net_Amount_VAT_AGN__c,KR_Customer_Price_AGN__c,KR_List_Price_VAT_AGN__c FROM Order_Line_vod__c WHERE Order_vod__r.Id=: orderrId];
       
        system.debug('Order Lines'+ORDERLINES);
        
        return ORDERLINES;
        
    }
}

URGENT.
Thanks  in Advance
Hi ,
I want to modify the filter criteria of channel cycle criteria in MC cycle plan oject in veeva,i know these fields come from the picklist defined in MC channel vod object ,but all fields are not  included(Why??),lets say i want to drag a formula fieldof call object  to this criteria,
I would Appreciate your Help and Knowledge Sharing

Thanks in Advance
i have one picklist of products and a price field to give price when a product is selected,,
i want to write a validation rule so that when product is selected price have to be given and vice versa ,if product is not selected ,we should not enter price)

can anyone provide me a validation rule for this without using is related functions
Thanks in advance
Prabhat Jha
suppose i have two master objects M1 and M2 and linked through junction object J1,now i want to get data (how many m2 records are associated with M1) how can i achieve this??
please help
Thanks in Advance
I HAVE SHARED AN ACCOUNT RECORD TO CERTAIN USER,NOW I WANT TO NREMOVE THIS SHARING,BUT I AM NOT GETTING ANY EDIT BUTTON TO REMOVE THIS SHARING
i am not able to access the enteredacc variable value in my other vf pages,i am using  a single controller and also while moving from one page to another i am setting redirect to false,here is my apex classes and vf pages (3)
 apex class:
public class picklistdemo1{

public picklistdemo1(ApexPages.StandardController controller) {

}
public String enteredacc {get; set;}
public String Acno1{get;set;}
public String Acname{get;set;}
public Double AcAnnualRevenue{get;set;}
public String AcPhone{get;set;}
public Date Acdate{get;set;}
public void accDetails()

system.debug('enteredaccno is '+enteredacc); 
if(enteredacc == '' || enteredacc == null){
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Please enter valid Account number or if you are a new user register by clicking the below button'));
return ;
}
else
{

List<Account> acc=[Select Name,AccountNumber,AnnualRevenue,Phone,SLAExpirationDate__c from Account where AccountNumber= :enteredacc];


for(Account a : acc)
{
Acno1=a.AccountNumber;
Acname=a.Name;
AcAnnualRevenue=a.AnnualRevenue;
AcPhone=a.Phone;
Acdate=a.SLAExpirationDate__c;
}

}


}


public PageReference show1() {
return null;
}

public ORDER__c rec=new ORDER__c();
public List<SelectOption> listofbooks{get;set;}

public list<String> selectedbooks { get; set; }

public PageReference add() {

rec.Accountname__c=enteredacc;
rec.select_books__c=String.join(selectedbooks,',');
insert rec;
return null;
}
public PageReference gotoPage() {
PageReference pr = Page.multipicklist;
pr.setRedirect(false);
return pr;
}
public PageReference gotoPageagain() {
PageReference pr = Page.adding_order;
pr.setRedirect(false);
return pr;
}

public picklistdemo1()
{
listofbooks=new List<SelectOption>();
listofbooks.add(new SelectOption('b1','b1'));
listofbooks.add(new SelectOption('b2','b2'));
listofbooks.add(new SelectOption('b3','b3'));
listofbooks.add(new SelectOption('b4','b4'));
listofbooks.add(new SelectOption('b5','b5'));
listofbooks.add(new SelectOption('b6','b6'));
listofbooks.add(new SelectOption('b7','b7'));
listofbooks.add(new SelectOption('b8','b8'));
listofbooks.add(new SelectOption('b9','b9'));
listofbooks.add(new SelectOption('b10','b10'));

}
}
istvf page:
<apex:page standardController="Account" extensions="picklistdemo1">
<apex:form >
<apex:pageBlock id="firstblock" >
<apex:pageMessages id="showmsg"></apex:pageMessages>
<apex:pageBlockSection >
<apex:outputText >Enter Account Number:</apex:outputText>
<apex:inputText value="{!enteredacc}"/>
</apex:pageBlockSection>
<apex:commandButton value="Search" action="{!accDetails}" rerender="firstblock,nextblock,showmsg"/>
<apex:outputText >enteredacc:{!enteredacc}</apex:outputText>
<apex:commandButton value="Next!" action="{!gotoPage}"/>
</apex:pageBlock>

<apex:pageBlock id="nextblock">
<apex:pageBlockSection title="ACCOUNTDETAILS">
<apex:outputText >Account Number:</apex:outputText>
<apex:inputText value="{!Acno1}"/>

<apex:outputText >Account Name:</apex:outputText>
<apex:inputText value="{!Acname}"/>
<apex:outputText >Annual Revenue:</apex:outputText>
<apex:inputText value="{!AcAnnualRevenue}"/>
<apex:outputText >Phone No.:</apex:outputText>
<apex:inputText value="{!AcPhone}"/>

</apex:pageBlockSection>
<apex:pageBlockSection title="REGESTRATION">


<apex:inputText value="{!Account.AccountNumber}"/>
<apex:inputText value="{!Account.name}"/>

<apex:inputText value="{!Account.AnnualRevenue}"/>

<apex:inputText value="{!Account.Phone}"/>

<apex:inputText value="{!Account.SLAExpirationDate__c}"/>


<apex:commandButton value="REGISTER!" action="{!save}"/>
</apex:pageBlockSection>

</apex:pageBlock>
</apex:form>
</apex:page>
2nd vf:
<apex:page controller="picklistdemo1">
<apex:form >
<apex:outputPanel >
<apex:outputLabel >select book from the list</apex:outputLabel>
<apex:selectList value="{!selectedbooks}" size="6" multiselect="true">
<apex:selectOptions value="{!listofbooks}">
<apex:commandbutton value="Show Values" action="{!show1}" rerender="pbs1,pbs2"/>
<apex:commandButton value="NEXT" action="{!gotoPageagain}"/>

</apex:selectOptions>
</apex:selectList>
</apex:outputPanel>
</apex:form>


<apex:pageBlock title="selected books">
<apex:pageBlockSection id="pbs1">
<apex:pageBlockSectionItem >
{!selectedbooks}
</apex:pageBlockSectionItem>
<apex:pageBlock title="accountvalue">
<apex:pageBlockSection id="pbs2">
<apex:pageBlockSectionItem > {!enteredacc}</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:page>
3rd vf:
<apex:page controller="picklistdemo1">
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection title="order information">
<apex:outputText > value="{!enteredacc}"</apex:outputText>
<apex:outputText > value="{!selectedbooks}"</apex:outputText>
<apex:commandButton value="PLACE ORDER" action="{!add}" />
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
please help ,i am stuck in these for several hours.....
Thanks in advance
 
Hello Friends,
I am working on Work with GeoJSON and Create the Map
Get the GeoJSON File Challenge under (
Create a Custom Map for Einstein Analytics Charts ) using https://developer.salesforce.com/files/custom_map_project_geojson.json geojson file which seems correctly formatted,Still it throws Invalid Json when i upload.
Could you please help?
i have written one trigger to insert a new Account species/consultation record  (ZTS_EU_Account_Species_Potential__c) if species name matches the species listed in my custom setting (SpeciesList__c) which has three fields parentspeciesname,childspeciesname  and one factor (number field).but my insert statement fails and throws the mentioned error ,i am stuck with this error for previous 24 hrs ,any help would be appreciated.here species is a different object (ZTS_EU_Species__c ) and lookup field of Account consultation records.
here is my trigger:
trigger createChildSpecies on ZTS_EU_Account_Species_Potential__c (before Insert) {
    ID accctid;
    ID Speciesid;
    ID childspeciesid;
    String Speciesname;
    Double Parentcount;
    String CHLDSpeciesname;
    String myCCVal ;
    ZTS_EU_Species__c test=new ZTS_EU_Species__c ();
    ZTS_EU_Species__c childtestforid=new ZTS_EU_Species__c ();
    
    
    
    ZTS_EU_Account_Species_Potential__c PARENTRECORD;
    ZTS_EU_Account_Species_Potential__c chld=new ZTS_EU_Account_Species_Potential__c();
    for(ZTS_EU_Account_Species_Potential__c a:trigger.new)
    {
        //PARENTRECORD.Account__c=a.Account__c;
        Speciesid=a.ZTS_EU_Species_Potential__c;
        system.debug('parentspeciesnameeee===='+Speciesid);
        test=[SELECT Name FROM ZTS_EU_Species__c WHERE ZTS_EU_Market__c = 'Spain' AND Id =:Speciesid];
        Speciesname=test.Name ;
        system.debug('speciesname===='+Speciesname);
        Map<String, SpeciesList__c> mapStatusCodeCustomSetting = SpeciesList__c.getAll();
        for(SpeciesList__c mandatoryRoles : mapStatusCodeCustomSetting.values()){
            if (mandatoryRoles .ParentSpeciesName__c==Speciesname)
            {
                myCCVal = mandatoryRoles .ChildSpeciesName__c;
                childtestforid=[SELECT Id FROM ZTS_EU_Species__c WHERE ZTS_EU_Market__c = 'Spain' AND Name =:myCCVal ];
                system.debug('myCS1 ===='+myCCVal);
                
            }
        }
            
            
            
            chld.Account__c=a.Account__c;         
            childspeciesid=childtestforid.Id;
            system.debug('childspeciesid===='+childtestforid);
            chld.ZTS_EU_Species_Potential__c=childspeciesid;
            chld.ZTS_EU_Animal_Consultations_new__c=10;
            insert(chld);
    }
    
}

 
Hi All

We are creating a follow up task from our webapp using SOAP api call in C#. Now we want to set Reminder Set(IsReminderSet) field value while creating the task
We are using below code. We are able to create follow up task with all other fields but unable to set Reminder Set field which is of type boolean.

var doc = new XmlDocument();
var fields = new List<XmlElement>();
var task = new sObject { type = "Task" };
bool reminder = true;
XmlElement taskReminder = doc.CreateElement("IsReminderSet");
 taskReminder.InnerText = reminder.ToString();
fields.Add(taskReminder);
task.Any = fields.ToArray();
var result = _sf.create(new[] { task });
success = result[0].success;

Please let me know what I am doing wrong.

Regards
Ankit
i have first name last name field both field display on same line in page lay out 
I HAVE SHARED AN ACCOUNT RECORD TO CERTAIN USER,NOW I WANT TO NREMOVE THIS SHARING,BUT I AM NOT GETTING ANY EDIT BUTTON TO REMOVE THIS SHARING
i am not able to access the enteredacc variable value in my other vf pages,i am using  a single controller and also while moving from one page to another i am setting redirect to false,here is my apex classes and vf pages (3)
 apex class:
public class picklistdemo1{

public picklistdemo1(ApexPages.StandardController controller) {

}
public String enteredacc {get; set;}
public String Acno1{get;set;}
public String Acname{get;set;}
public Double AcAnnualRevenue{get;set;}
public String AcPhone{get;set;}
public Date Acdate{get;set;}
public void accDetails()

system.debug('enteredaccno is '+enteredacc); 
if(enteredacc == '' || enteredacc == null){
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Please enter valid Account number or if you are a new user register by clicking the below button'));
return ;
}
else
{

List<Account> acc=[Select Name,AccountNumber,AnnualRevenue,Phone,SLAExpirationDate__c from Account where AccountNumber= :enteredacc];


for(Account a : acc)
{
Acno1=a.AccountNumber;
Acname=a.Name;
AcAnnualRevenue=a.AnnualRevenue;
AcPhone=a.Phone;
Acdate=a.SLAExpirationDate__c;
}

}


}


public PageReference show1() {
return null;
}

public ORDER__c rec=new ORDER__c();
public List<SelectOption> listofbooks{get;set;}

public list<String> selectedbooks { get; set; }

public PageReference add() {

rec.Accountname__c=enteredacc;
rec.select_books__c=String.join(selectedbooks,',');
insert rec;
return null;
}
public PageReference gotoPage() {
PageReference pr = Page.multipicklist;
pr.setRedirect(false);
return pr;
}
public PageReference gotoPageagain() {
PageReference pr = Page.adding_order;
pr.setRedirect(false);
return pr;
}

public picklistdemo1()
{
listofbooks=new List<SelectOption>();
listofbooks.add(new SelectOption('b1','b1'));
listofbooks.add(new SelectOption('b2','b2'));
listofbooks.add(new SelectOption('b3','b3'));
listofbooks.add(new SelectOption('b4','b4'));
listofbooks.add(new SelectOption('b5','b5'));
listofbooks.add(new SelectOption('b6','b6'));
listofbooks.add(new SelectOption('b7','b7'));
listofbooks.add(new SelectOption('b8','b8'));
listofbooks.add(new SelectOption('b9','b9'));
listofbooks.add(new SelectOption('b10','b10'));

}
}
istvf page:
<apex:page standardController="Account" extensions="picklistdemo1">
<apex:form >
<apex:pageBlock id="firstblock" >
<apex:pageMessages id="showmsg"></apex:pageMessages>
<apex:pageBlockSection >
<apex:outputText >Enter Account Number:</apex:outputText>
<apex:inputText value="{!enteredacc}"/>
</apex:pageBlockSection>
<apex:commandButton value="Search" action="{!accDetails}" rerender="firstblock,nextblock,showmsg"/>
<apex:outputText >enteredacc:{!enteredacc}</apex:outputText>
<apex:commandButton value="Next!" action="{!gotoPage}"/>
</apex:pageBlock>

<apex:pageBlock id="nextblock">
<apex:pageBlockSection title="ACCOUNTDETAILS">
<apex:outputText >Account Number:</apex:outputText>
<apex:inputText value="{!Acno1}"/>

<apex:outputText >Account Name:</apex:outputText>
<apex:inputText value="{!Acname}"/>
<apex:outputText >Annual Revenue:</apex:outputText>
<apex:inputText value="{!AcAnnualRevenue}"/>
<apex:outputText >Phone No.:</apex:outputText>
<apex:inputText value="{!AcPhone}"/>

</apex:pageBlockSection>
<apex:pageBlockSection title="REGESTRATION">


<apex:inputText value="{!Account.AccountNumber}"/>
<apex:inputText value="{!Account.name}"/>

<apex:inputText value="{!Account.AnnualRevenue}"/>

<apex:inputText value="{!Account.Phone}"/>

<apex:inputText value="{!Account.SLAExpirationDate__c}"/>


<apex:commandButton value="REGISTER!" action="{!save}"/>
</apex:pageBlockSection>

</apex:pageBlock>
</apex:form>
</apex:page>
2nd vf:
<apex:page controller="picklistdemo1">
<apex:form >
<apex:outputPanel >
<apex:outputLabel >select book from the list</apex:outputLabel>
<apex:selectList value="{!selectedbooks}" size="6" multiselect="true">
<apex:selectOptions value="{!listofbooks}">
<apex:commandbutton value="Show Values" action="{!show1}" rerender="pbs1,pbs2"/>
<apex:commandButton value="NEXT" action="{!gotoPageagain}"/>

</apex:selectOptions>
</apex:selectList>
</apex:outputPanel>
</apex:form>


<apex:pageBlock title="selected books">
<apex:pageBlockSection id="pbs1">
<apex:pageBlockSectionItem >
{!selectedbooks}
</apex:pageBlockSectionItem>
<apex:pageBlock title="accountvalue">
<apex:pageBlockSection id="pbs2">
<apex:pageBlockSectionItem > {!enteredacc}</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:page>
3rd vf:
<apex:page controller="picklistdemo1">
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection title="order information">
<apex:outputText > value="{!enteredacc}"</apex:outputText>
<apex:outputText > value="{!selectedbooks}"</apex:outputText>
<apex:commandButton value="PLACE ORDER" action="{!add}" />
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
please help ,i am stuck in these for several hours.....
Thanks in advance
 
We have a need to copy the data from the LoginHistory object to a custon loginHistory object on a regular basis. This is a large organization with a lot of activity. I know we can do this manually with the dataloader. 

Can an Apex Batch job support this type of activity?

Can anyone point us to some sampple apex code that copies data from one object to another?

Thanks