• Ashish Kumar
  • NEWBIE
  • 389 Points
  • Member since 2016
  • Genpact HeadStrong Capital Markets


  • Chatter
    Feed
  • 10
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 80
    Replies
All my values transferred good, but it's just Strings. When I try to post Picklist value into Text field I get this in debug msg: [{"message":"Unexpected parameter encountered during deserialization: location at [line:9, column:17]","errorCode":"JSON_PARSER_ERROR"}]
I have been asked to dectivate the existing Dupecatcher filter for contact and lead email address (screenshot attached).
However, I am unable to find them under the Setup menu. Could you guide me to the correct location? This is my first time working on Dupecatcher filters, hence, I'd appreciate any inputs.

To be deactivated - "contact email address"
User-added image

To be deactivated - "lead email address"
User-added image
Unable to find any dupecatcher filter with the above name
User-added image
  • March 20, 2018
  • Like
  • 0
Have a custom field Weight on Contact object. There is a validation rule which prevents this field from editing after Pet-ID (custom field) is saved. We have an apex controller which lets only Profile1 Team to edit it. However now, we want System Administrators to edit this field as well. If i changes SOQL to SELECT Id from Profile where Name = 'Profile1' or 'System Administrator', end up getting two results. Have to change data type which i do not want. Is there an easier way to do this? 

Initial logic was,
Id setProfileId = [SELECT Id FROM Profile WHERE Name = 'Profile1 Team' LIMIT 1].Id;

this.isSetUser = UserInfo.getProfileId() == setProfileId;
In the given code below i am passing json string 'name' in to http post method.In the rest callout mthod i serialized Account object in to JSON String.When i try to deserislize it in HttpPost method Im getting JSON parser error, Can anyone Please Help Me??

//This is the rest webservice
@Httppost
    Global static Account doPost(String name){
        //System.debug(name);
     Account tn=(Account)JSON.deserialize(name, Account.class);
    
        insert tn;Error message
        
        return tn;
        
    }
Hi,

I have a custom object child of the opportunity object.
I want make a SOQL from the child to get the data of the Opportunity.
Someone know how I do that?
Some best practice in this case.

Thanks

Rafael
Hi all,

We're thinking about activating Dev Hub in our production org, but I see that once it's been enabled, it can't be disabled. Is there any downside to enabling Dev Hub? Will we still have access to our old sandbox system? There's a lot of in-flight development in the current sandboxes and we don't want to change the way we work yet, we just want to explore Dev Hub and see it working in a practical environment.

Is there anything else we might need to bear in mind when activating Dev Hub? The documentation is a bit patchy on this subject.

Thanks!
I have a controller for my custom object that is currently sorting columns in my table. However, it's sorting on every column. 
public class ExhibitAController {
    public Customer_Pricing__c cust {get;set;}
    public List<Customers_Product_Code__c> customerproducts {get;set;}
        
    public ExhibitAController(ApexPages.StandardController stdController){
    
        this.cust = (Customer_Pricing__c)stdController.getRecord();

        customerproducts  = [select Description_for_Invoice__c,TSDF_Approval_Number__c,Caveats__c,Category__c,Container_Size__c,UM__c,Price__c from Customers_Product_Code__c where Customer_Pricing__c =:cust.Id];
    
            customerproducts.sort();

    }
    

    
}

How do I adjust the code to only sort on columns/fields that I specify? 
I am building an Intelligent Assistance with Live Agent Chat. It automatically suggest possible answers to agent and Agent can just select any one (when agent select any response, it is sent to chat box) to send response to customer. There is a case of decision tree when Intelligent Assistance need to ask question in form of Yes or No from customer. I want to do this by rendering button or link for Yes / No to customer and when customer clicks on that a JavaScript function should be called to call a Web Service endpoint.

In Summary what i need (at agent chat box end) is to be able to send a HTML + CSS + JS formated text from Agent side of chat to Customer and Customer should be able to click on Yes / No link or button.

When i try pushing a HTML, CSS, JS formatted text automatically in chat at agent side, it is rendered to Agent as well as Customer chat window as text and not properly formatted. Any idea how to customize / custom code Live Agent chat to achieve this?

Please help!!
public class wrapperClassController {
    // This is our wrapper/container class. A container class is a class, a data structure, or an abstract data type whose instances are collections of other objects. In this example a wrapper class contains both the standard salesforce object Contact and a Boolean value
    public class lntypes {
        public License_Numbers__c con {get; set;}
        public Boolean tobeEdited {get; set;}

        //This is the contructor method. When we create a new cContact object we pass a Contact that is set to the con property. We also set the selected value to false
        public lntypes(License_Numbers__c c) {
            con = c;
            tobeEdited = false;
        }
    }
        
    //Our collection of the class/wrapper objects cContact
    public List<lntypes> licList {get; set;}

    //This method uses a simple SOQL query to return a List of Contacts
    public List<lntypes> getLicenseList17() {
        if(licList == null) {
            licList = new List<lntypes>();
            for(License_Numbers__c c:[select id, Name, X2016_Cost__c, Business_Unit__c, X2016_Starting_Amount__c, X2016_Subtotal__c, BMS_Code__c, License_Type__c, Monthly_Unit_Price__c, Org__c FROM License_Numbers__c ]) {

                // As each contact is processed we create a new cContact object and add it to the contactList
                licList.add(new lntypes(c));
            }
        }
        return licList;
    }
    public PageReference saveRecord() {

        //We create a new list of Contacts that we be populated only with Contacts if they are selected
        List<License_Numbers__c> selectedTypes = new List<License_Numbers__c>();

        //We will cycle through our list of cContacts and will check to see if the selected property is set to true, if it is we add the Contact to the selectedContacts list
        for(lntypes cCon: getLicenseList17()) {
            if(cCon.tobeEdited == true) {
                selectedTypes.add(cCon.con);
            }
        }

        // Now we have our list of selected contacts and can perform any type of logic we want, sending emails, updating a field on the Contact, etc
        System.debug('These are the selected Contacts...');
        for(License_Numbers__c con: selectedTypes) {
            system.debug(con);
        }
        contactList=null; // we need this line if we performed a write operation  because getContacts gets a fresh list now
        return null;
    }

    
}
I have a wrapper class that is suppose to loop through some license records and then if one is edited to update it.  

Just copying the wrapper class from SFCD and changing the variable to match what I need I'm getting a unexpected token 'class'  at line 70 column 11

Line 70
public class lntypes {

What is my problem?
 
  • September 21, 2016
  • Like
  • 0
I am new to salesforce and given the documentation I am at a loss of where to start! If someone could write a test class for the following piece of code that would be most handy. I have simplified the method. I don't quite understand the 100% code coverage. I saw another post write something that didn't really make a whole bunch of sense.
 
public static string getJsonListOfAccounts () {

        String searchName = Apexpages.currentPage().getParameters().get('name');  

        String searchType = Apexpages.currentPage().getParameters().get('type');

        List<Account> listOfAccounts = new List<Account>();
       
        if (searchType == 'yes') {

            jsonListOfAccounts = [SELECT Id, Name, SummitElse from Account where example__c =: 'yes' AND Name like : '%'+ searchString +'%']; 

        } else {

            jsonListOfAccounts = [SELECT Id, Name from Account where example__c =: 'no' AND Name like : '%'+ searchString +'%']; 

        }
       
        return JSON.serializePretty(jsonListOfAccounts);

    }

 
  • September 21, 2016
  • Like
  • 0
Hey Guys,
I am having a VF component which creates a pie chart. When I use that component in my VF page charts renders properly but when I embed it in Email Template chart does not render at all. 
Please suggest some way to send chart as in email template.
Below is the component code which I am using 
<apex:component controller="PieChartController" access="global">
    <apex:chart height="350" width="450" data="{!pieData}">
        <apex:pieSeries dataField="data" labelField="name"/>
        <apex:legend position="right"/>
    </apex:chart>
</apex:component>
---------------------------------------
PieChartController Class
 
public class PieChartController {
    public List<PieWedgeData> getPieData() {
        List<PieWedgeData> data = new List<PieWedgeData>();
        data.add(new PieWedgeData('Jan', 30));
        data.add(new PieWedgeData('Feb', 15));
        data.add(new PieWedgeData('Mar', 10));
        data.add(new PieWedgeData('Apr', 20));
        data.add(new PieWedgeData('May', 20));
        data.add(new PieWedgeData('Jun', 5));
        return data;
    }
    // Wrapper class
    public class PieWedgeData {

 
        public String name { get; set; }
        public Integer data { get; set; }

 
        public PieWedgeData(String name, Integer data) {
            this.name = name;
            this.data = data;
        }
    }
}

Hi All,

Does anyone have any idea to how to count the number of occurrences of all the elements present in a list ? For Example, I have a list of names.
List is having 10 elements with values {A,B,C,D,A,B,A,A,A,A}. Now here A came 6 times, B came 2 times , C came 1 time and D also 1 time. But I don't know how to do it in apex.
Please help how can I get the count of repeated values in apex.
Hi Everyone,
I am new with salesforce and I am still my learning phase.
I just wanted to know whether could we use VF standard stylesheet and external stylesheet such as bootstrap simultaneously? If yes, please let me know how to use??

Thanx in advance.
HI i am having a users who is in high hierachy  having modify all and delete access on opportunity and documents and OWD for opportunities is REad/write,BUt user is not able to delete files on opportunity of his lower level users record.can anyone pls help
I wrote my Callout, but it create an object only with Id. How can I create an object with all fields?
HttpPost:
public static App__c ParseRequest(RestRequest req) {
    App__c app = new App__c();
    String body = req.requestBody.toString();
    app = (App__c)JSON.deserialize(body, App__c.class);
    return app;  
}

@HttpPost
global static Id doPost() 
{
    RestRequest req = RestContext.request;        
    App__c app = ParseRequest(req);
    insert app;
    return app.id;
}
Callout:
public static void postCallout() {

    Settings__c settings = [SELECT ConsumerKey__c, ClientSecret__c, Username__c, Password__c, SecurityToken__c
                            FROM Settings__c
                            WHERE Name = 'OurSettings'];  
    String consumerKey = settings.ConsumerKey__c;
    String consumerSecret = settings.ClientSecret__c;
    String username = settings.Username__c;
    String password = settings.Password__c + settings.SecurityToken__c;
    String request = 'grant_type=password&client_id=' + consumerKey +'&client_secret=' + consumerSecret +
                     '&username=' + username + '&password='+password;

    HttpRequest ourRequest = new HttpRequest();
    ourRequest.setBody(request);
    ourRequest.setMethod('POST');
    ourRequest.setEndpoint(System.Label.Job_Advertisement_URL + '/services/oauth2/token');

    Obj__c obj = [SELECT Name, Description__c, Skills__c
                       FROM Obj__c WHERE Name = 'Object'];

    HttpResponse response = ourHttp.send(request);      
    OAuth2 objAuthenticationInfo = (OAuth2)JSON.deserialize(response.getbody(), OAuth2.class);
    System.debug('BODY: ' + response.getBody());

    if(objAuthenticationInfo.ACCESS_TOKEN != null){

        JSONGenerator gen = JSON.createGenerator(true);    
        gen.writeStartObject();
        gen.writeStringField('title', obj.Name);
        gen.writeStringField('description', obj.Description__c);
        gen.writeStringField('skills', obj.Skills__c);

        String jsonString = gen.getAsString();
        System.debug('jsonMaterials: ' + jsonString);

        Http finalHttp = new Http();
        HttpRequest finalRequest = new HttpRequest();

        finalRequest.setHeader('Authorization','Bearer ' + objAuthenticationInfo.ACCESS_TOKEN);
        finalRequest.setHeader('Content-Type','application/json');
        finalRequest.setHeader('accept','application/json');
        finalRequest.setBody(jsonString);

        finalRequest.setMethod('POST');
        finalRequest.setEndpoint(System.Label.URL + '/services/apexrest/AppEndpoint');
        HttpResponse finalResponse = finalHttp.send(finalRequest);
        System.debug('RESPONSE BODY: '+ finalResponse.getBody());
    }
}

public class OAuth2{
    public String ACCESS_TOKEN{get;set;}    
}

 
Hi All,
        how to cover this method in test class?
 public static void addTagsToSocialPost( SocialPost spObj, 
                                            String tags , 
                                            //Map<String, Id> predictionTags,
                                            List<ApiLog__c> apiLogsList){
        // Api call to update  tag to post
        List<ApiLog__c> apiLogList = new List<ApiLog__c>();
        apiLogList.addAll(apiLogsList);
        Map<String, List<ApiLog__c>> accessTokenMap = getAccessToken( spObj
                                                                     //, tags , predictionTags
                                                                     );
        String accessToken  = '';
        for(String at : accessTokenMap.keySet()){
           accessToken = at; 
        }
        apiLogList.addAll(accessTokenMap.get(accessToken));
        HttpRequest req = new HttpRequest();
        req.setMethod('POST');
        req.setEndpoint( 'https://api.radian6.com/socialcloud/v1/post/workflow/tags/' + spObj.R6PostId);
        req.setHeader('auth_token', accessToken); 
        req.setHeader('auth_appkey', Label.AppKey);
        Http binding = new Http();
        String tagsToSend = 'tags:'+ tags;
        req.setBody('tags='+tags);
        req.setHeader('content-type','application/x-www-form-urlencoded');
        HttpResponse res;
        res = binding.send( req );
        try{
            res = binding.send( req );
            ApiLog__c apiLog = new ApiLog__c();
            apiLog.EndPoint__c = req.getEndpoint();
            apiLog.ImageURL__c = '';
            //apiLog.Prediction__c = predictionTags.get(tags);
            apiLog.RequestBody__c = req.getBody();
            apiLog.ResponseBody__c = res.getBody();
            apiLog.SocialPost__c = spObj.Id;
            apiLog.StatusCode__c = String.valueOf(res.getStatusCode());
            apiLog.Type__c = 'Social Studio';
            apiLogList.add(apiLog);
        }catch(Exception e){
            ApiLog__c apiLog = new ApiLog__c();
            apiLog.EndPoint__c = req.getEndpoint();
            apiLog.ImageURL__c = '';
            //apiLog.Prediction__c = predictionTags.get(tags);
            apiLog.RequestBody__c = req.getBody();
            apiLog.ResponseBody__c = res.getBody();
            apiLog.SocialPost__c = spObj.Id;
            apiLog.StatusCode__c = String.valueOf(res.getStatusCode());
            apiLog.Type__c = 'Social Studio';
            apiLogList.add(apiLog);
        }
        insert apiLogList;
        
    }
    
All my values transferred good, but it's just Strings. When I try to post Picklist value into Text field I get this in debug msg: [{"message":"Unexpected parameter encountered during deserialization: location at [line:9, column:17]","errorCode":"JSON_PARSER_ERROR"}]
Here is my code,  I was not able to find the error ..
====================================
component :
<aura:component controller = "opplist">
    <aura:attribute name="opportunities" type="list"/>
    <aura:handler name="init" value="doinit" action="{!v.doinit}"/>
    <table class="slds-table slds-table--bordered slds-table--striped slds-table--cell-buffer slds-table--fixed-layout">
        <thead>
          <tr class="slds-text-heading--label">
            <th scope="col"><div class="slds-truncate" title="ID">ID</div></th>
            <th scope="col"><div class="slds-truncate" title="Name">AccountId</div></th>
            <th scope="col"><div class="slds-truncate" title="Type">probability</div></th>
            <th scope="col"><div class="slds-truncate" title="Number Of Employees">stageName</div></th>
            <th scope="col"><div class="slds-truncate" title="Ticker Symbol">Close Date</div></th>
            <th scope="col"><div class="slds-truncate" title="Phone">Opportunity Currency</div></th>
            <th scope="col"><div class="slds-truncate" title="Delete">Amount</div></th>
          </tr>
        </thead>
        <tbody>
            <aura:iteration items="{!v.opportunities}" var ="x">
                <tr>
          <th scope="row"><div class="slds-truncate" title="{!account.Id}">{!x.Id}</div></th>
          <td><div class="slds-truncate" title="{!account.Name}">{!x.AccountId}</div></td>
          <td><div class="slds-truncate" title="{!account.Type}">{!x.probability}</div></td>
          <td><div class="slds-truncate" title="{!account.NumberOfEmployees}">{!x.stageName}</div></td>
          <td><div class="slds-truncate" title="{!account.NumberOfEmployees}">{!x.closeDate}</div></td>
          <td><div class="slds-truncate" title="{!account.TickerSymbol}">{!x.OpportunityCurrency}</div></td>
          <td><div class="slds-truncate" title="{!account.Phone}">{!x.Amount}</div></td>
                </tr>
           </aura:iteration>                            
        </tbody>
    </table>
</aura:component>
===============================================
controller :
public class opplist {
   
    @AuraEnabled
    public static list<opportunity> getopplist(){
        
        list<opportunity> opps = new list<opportunity>([select Id,AccountId,probability,stageName from opportunity]);
        return opps;
    }
}
===========================
Helper controller :

({
    getopplist : function(component) {
         var action = component.get("v.getopplist");
        
        var self = this;
        action.setCallback(this, function(actionResult) {
            
            component.set('v.getopplist', actionResult.getReturnValue());
         });
          $A.enqueueAction(action);
    }
})

================================================
component controller

({
    doinit : function(component, event, helper) {
        helper.getAccountlist(component);
    }
})

 
From the offical documentation, I think there are two ways to access Salesforce data from a hybrid app:
a. REST API
b. download a Visualforce page which connects to a Apex controller to query data
(Please correct me if my understanding is invalid.)

As we do not want to consume vast amout of API calls, we are trying to access the Salesforce data through a VIsualforce page. However, there are no specific documentation to walkthrough the ways to 'embed' a Visualforce page into a hybrid app. We tried to directly open the page (.../apex/page) through an in-app browser but sometimes this requires extra login despite the fact that the login process is completed when the app starts.

Anyone knows the correct way to open a Visualforce page inside a hybrid app?


 
I have been asked to dectivate the existing Dupecatcher filter for contact and lead email address (screenshot attached).
However, I am unable to find them under the Setup menu. Could you guide me to the correct location? This is my first time working on Dupecatcher filters, hence, I'd appreciate any inputs.

To be deactivated - "contact email address"
User-added image

To be deactivated - "lead email address"
User-added image
Unable to find any dupecatcher filter with the above name
User-added image
  • March 20, 2018
  • Like
  • 0
I have created API (an apex class with restful service - HttpGet) to expose the User Details to an external system in which I am sending all the details regarding users like Name, Email, Language etc. Now I want to send the Profile Photo also, I know we can query and get SmallPhotoUrl and FullPhotoUrl but I don't want URL. I want the actual image in Base64 format.
Any Ideas for this?

Hi Experts,

I am trying to insert child opportunity records details in system by clubbing all the details to its parent opportunities. Like if i have one parent opportunity and multiple child records so after some custom calculations, i want to insert single record in an other custom object under parent opportunity name.

but i am getting the same error while running this batch class on batch size of 50 but while running the same code for 1 batch size it running perfectly.
What should I do?
my code:
global class XXXXX implements Database.Batchable<sObject>,Database.Stateful {  
    private Date DT1;

    public XXXXX(Date DT) {   
        DT1 = DT;
    }
    global Database.QueryLocator start(Database.BatchableContext BC) {
       String Query = 'Select id, accountid, Name, Disbursement_Date__c, CloseDate, Actual_Maturity_Date__c, Sanction_Amount__c, Current_Face__c,StageName,LastModifiedDate, RecordType.Name, Account_Record_Type__c, Original_face__c, current_factors__c, LeadSource__c,LeadSource__r.name,Credit_Approved_Date__c,Credit_Type__c,Loan_Tenor_in_Month__c,Maturity_Date__c,Credit_Rating__c,Amortization_Type__c,Parent_Opportunity__c,Parent_Opportunity__r.Name from Opportunity where ((RecordType.Name= \'XXXXX\') and (StageName = \'XXXXX\' OR StageName = \'XXXXX\' OR StageName = \'XXXXX\' OR (LeadSource__r.name=\'XXXXX\' and StageName = \'XXXXX\')  ))';
        return Database.getQueryLocator(Query);
    }
    
    global void execute(Database.BatchableContext BC, List<Opportunity> scope) {
            system.debug('Scope  :'+ Scope);
        try{
            List<CIBIL_Reporting__c> XXXXX= new List<CIBIL_Reporting__c>();
            Set<id>accId=new Set<id>();
            Set<id>oppId=new Set<id>();
            Set<id>oppparntId=new Set<id>();
            Map<id,Opportunity>mapOpp=new Map<id,Opportunity>();
            List<Payment_Schedules__c> pslist=new List<Payment_Schedules__c>();
            Map<id,Contact> Mapcon=new Map<id,Contact>();
            Map<Id, Opportunity> oppMap =  new Map<Id, Opportunity>();
for(opportunity opp : Scope){ 
                accId.add(opp.AccountId);
                oppparntId.add(opp.id);
oppMap.put(opp.id, opp);
            }
            system.debug('==accId=='+accId);
            if(accId!=null && accId.size()>0){
                for(Contact con: [Select Id,Account.Parent.name,District_eKYC__c,Date_of_Birth_eKYC__c,Passport_Id__c,account.name,account.ParentId,
                                account.Business_Category__c,account.Industry,Account.Aadhaar_Number__c,Account.Salutation,Account.Legal_Constitution__c,account.AccountNumber,account.CIN__c,
                                Account.BillingPostalCode, accountid,Account.PAN__c, Name, Birthdate, Gender__c, PAN_ID__c, Aadhaar_Number__c,Phone, Email, Official_Email__c,
                                MobilePhone, HomePhone, Alt_Phone__c, OtherPhone, Voter_Id__c, Driving_License__c, Mailing_Address__c, Address_Category__c, 
                                Borrower_Type__c, mailingStreet, mailingState,Account.Incorporation_Date__c, mailingPostalCode, mailingCountry, mailingCity,
                                Borrower_Office_Type__c,Pin_Code_eKYC__c,Fax,Account.Phone from Contact where accountid In: accId]){
                                
                    if(con.accountid!=null)
                        Mapcon.put(con.accountid,con);                
                }
            }
            system.debug('==Mapcon=='+Mapcon);
            system.debug('==oppparntId=='+oppparntId);
            for(opportunity opp: [Select id, accountid, Name, Disbursement_Date__c, CloseDate, Actual_Maturity_Date__c, Sanction_Amount__c, Current_Face__c,StageName,LastModifiedDate, RecordType.Name, Account_Record_Type__c, Original_face__c, current_factors__c, LeadSource__c,LeadSource__r.name,Credit_Approved_Date__c,Credit_Type__c,Loan_Tenor_in_Month__c,Maturity_Date__c,Credit_Rating__c,Amortization_Type__c,Parent_Opportunity__c,Parent_Opportunity__r.Name from Opportunity where Parent_Opportunity__c IN:oppparntId]){  
                if(Mapcon.containskey(opp.accountid)){                
                    If (Opp.RecordType.Name !='XXXXX' && Opp.Parent_Opportunity__c!= null ){
                        oppId.add(opp.id);
                        mapOpp.put(opp.id,opp);
                    }

               }
            }
            
            Integer SanctionAmount = 0;
            Integer Noofday = 0;
            Decimal CF = 0.0;
            Integer AmtOverdue = 0;
            Boolean Flag = false;
            Date lastPaymentReceived;
            
            system.debug('==oppId=='+oppId);
            system.debug('OPPID SIZE =='+ oppId.size());
            system.debug('MAPOPP SIZE =='+ mapOpp.size());
            if(oppId!=null && oppId.size()>0){
                pslist= [select id, Opportunity__r.Sanction_Amount__c,Opportunity__c,Opportunity__r.AccountId,Opportunity__r.Parent_Opportunity__c,
                                                Opportunity__r.Account_Record_Type__c,Payment_Received_Date__c,ClosingPrincipalBal__c,
                                                Open_Principal__c,Clearance__c,Date__c,Net_Payment__c, Delinquent_Days__c from 
                                                Payment_Schedules__c where Opportunity__c IN: oppId and Date__c<:DT1 order by Date__c Desc];                            
            }
            system.debug('==pslist=='+pslist.size());
            
            if(pslist!=null && pslist.Size()>0){
                for(Payment_Schedules__c psch: pslist){
                     
                    if (psch.Opportunity__r.Sanction_Amount__c!=null)
                        SanctionAmount=integer.valueOf(psch.Opportunity__r.Sanction_Amount__c);       
                        
                                      
                    // if Payment is not received
                    if(psch.Clearance__c == false) {
                        flag = True;
                        if (psch.Net_Payment__c!=null) 
                            AmtOverdue+=integer.valueOf(psch.Net_Payment__c);
                            
                           // Noofday = psch.Date__c.daysBetween(DT1);
                            system.debug('No. of DPD: From ' + psch.Date__c + ' To ' + DT1 + Noofday);
                        
                            CF = psch.Open_Principal__c;
                            system.debug('Current Face: ' + CF);
                    }else{ // Payment is received
                        if(!flag){ // if all the Payment was received
                           // Noofday = psch.Date__c.daysBetween(DT1)-1;
                            
                            // if payment is received after Reported Date to CIBIL
                            if(psch.Delinquent_Days__c<=Noofday){
                              //  Noofday = Integer.Valueof(psch.Delinquent_Days__c);
                                CF = psch.ClosingPrincipalBal__c;
                            }else{
                                CF = psch.Open_Principal__c;
                            }
                            system.debug('No. of DPD: From 111: ' + psch.Date__c + ' To ' + DT1 + Noofday);                           
                            system.debug('Current Face 111: ' + CF);
                       }
                          lastPaymentReceived = psch.Payment_Received_Date__c;
                        system.debug('Last Payment Received: +' + psch.Payment_Received_Date__c);
                        
                        break;
                     }
                                
                 }
                 Map<Id,Double>mapdaycount=new Map<Id,Double>();
                AggregateResult[] groupedResults
                          = [SELECT Opportunity__c, Max(Delinquent_Days__c)
                              FROM Payment_Schedules__c where Opportunity__c IN: oppId and Opportunity__r.Parent_Opportunity__c != null and Date__c<:DT1
                              GROUP BY Opportunity__c];
                        
                for (AggregateResult ar : groupedResults)  
                {   
                Id oppId1 = (ID)ar.get('Opportunity__c');
                double temp = (Double)ar.get('expr0');
                temp=temp!=null?temp:0;
                    if(mapdaycount.containsKey(mapOpp.get(oppId1 ).Parent_Opportunity__c)){
                        double maxValue= mapdaycount.get(mapOpp.get(oppId1 ).Parent_Opportunity__c)!=null?mapdaycount.get(mapOpp.get(oppId1 ).Parent_Opportunity__c):0;
                
                        if(temp > mapdaycount.get(mapOpp.get(oppId1).Parent_Opportunity__c)){
                                mapdaycount.put(mapOpp.get(oppId1).Parent_Opportunity__c,temp);
                        }
                    
                    }
                    else{
                    mapdaycount.put(mapOpp.get(oppId1 ).Parent_Opportunity__c,temp);
                    }
                }
                system.debug('==mapdaycount=='+mapdaycount);
                 CIBIL_Reporting__c  cbp = new CIBIL_Reporting__c();
                 for(Payment_Schedules__c psch: pslist){
                     if(mapOpp.containskey(psch.Opportunity__c) && mapOpp.get(psch.Opportunity__c).Account_Record_Type__c == 'Retail Borrower Account' && Mapcon.containskey(psch.Opportunity__r.AccountId) && Mapcon.get(psch.Opportunity__r.AccountId).Borrower_Type__c == 'Borrower'){
                       
                       system.debug('==Test==');
                        cbp.Amt_Overdue__c = String.valueof(AmtOverdue);
                        cbp.Date_of_Last_Payment__c = lastPaymentReceived;
                        
                        cbp.Report_Month__c = DT1;
                        cbp.Current_Face__c = CF;
                        if(mapdaycount.containskey(psch.Opportunity__r.Parent_Opportunity__c))
                        cbp.No_of_Days_Pass_Due__c = mapdaycount.get(psch.Opportunity__r.Parent_Opportunity__c);
                        
                        cbp.Disbursement_Date__c = mapOpp.get(psch.Opportunity__c).CloseDate;
                        cbp.Actual_Maturity_Date__c = mapOpp.get(psch.Opportunity__c).Actual_Maturity_Date__c;
                        cbp.Date_closed__c = mapOpp.get(psch.Opportunity__c).Actual_Maturity_Date__c;
                        cbp.Sanction_Amount__c = mapOpp.get(psch.Opportunity__c).Sanction_Amount__c;
                        cbp.LeadSource__c = mapOpp.get(psch.Opportunity__c).LeadSource__r.name;
                        cbp.Curr_New_Account_No__c = mapOpp.get(psch.Opportunity__c).Name;
                        cbp.Opportunity_Name__c = mapOpp.get(psch.Opportunity__c).Parent_Opportunity__r.Name;
                        cbp.Account_Type__c = mapOpp.get(psch.Opportunity__c).RecordType.Name;
                        //cbp.CIBIL_Record_Type__c = mapOpp.get(psch.Opportunity__c).RecordType.Name;
                        cbp.CIBIL_Record_Type__c = 'Credit Facility Loan';
                   
                        
                        cbp.BirthDate__c = Mapcon.get(psch.Opportunity__r.AccountId).Birthdate;
                        cbp.PAN_ID__c = Mapcon.get(psch.Opportunity__r.AccountId).Account.PAN__c;
                        cbp.Aadhar_Number__c = Mapcon.get(psch.Opportunity__r.AccountId).Account.Aadhaar_Number__c;
                        cbp.Phone__c = Mapcon.get(psch.Opportunity__r.AccountId).Phone;
                        cbp.HomePhone__c = Mapcon.get(psch.Opportunity__r.AccountId).HomePhone;
                        cbp.Alt_Phone__c = Mapcon.get(psch.Opportunity__r.AccountId).Alt_Phone__c;
                        cbp.OtherPhone__c = Mapcon.get(psch.Opportunity__r.AccountId).OtherPhone;               
                        cbp.Gender__c = Mapcon.get(psch.Opportunity__r.AccountId).Gender__c;
                        cbp.Voter_ID__c = Mapcon.get(psch.Opportunity__r.AccountId).Voter_ID__c;
                        cbp.Driving_License__c = Mapcon.get(psch.Opportunity__r.AccountId).Driving_License__c;
                        cbp.Mobile_Phone__c = Mapcon.get(psch.Opportunity__r.AccountId).MobilePhone;
                        cbp.Email__c = Mapcon.get(psch.Opportunity__r.AccountId).Email;
                        cbp.Email1__c = Mapcon.get(psch.Opportunity__r.AccountId).Official_Email__c;
                        cbp.Address_Category__c = Mapcon.get(psch.Opportunity__r.AccountId).Address_Category__c;
                        cbp.Mailing_Address__c = Mapcon.get(psch.Opportunity__r.AccountId).Mailing_Address__c;
                        cbp.Street__c = Mapcon.get(psch.Opportunity__r.AccountId).mailingStreet;
                        cbp.Address_1__c = Mapcon.get(psch.Opportunity__r.AccountId).mailingStreet;
                        cbp.State__c = Mapcon.get(psch.Opportunity__r.AccountId).mailingState;
                        cbp.Postal_code__c = Mapcon.get(psch.Opportunity__r.AccountId).mailingPostalCode;
                        cbp.Country__c = Mapcon.get(psch.Opportunity__r.AccountId).mailingCountry;
                        cbp.City__c = Mapcon.get(psch.Opportunity__r.AccountId).mailingCity;
                        cbp.Account_Name__c = Mapcon.get(psch.Opportunity__r.AccountId).Accountid;               
                        cbp.Account_Id__c = Mapcon.get(psch.Opportunity__r.AccountId).Account.id;
                     }
                }           
                cibillst.add(cbp);
            }
            system.debug('==cibillst=='+cibillst.size());
            if(cibillst!=null && cibillst.size()>0)
                insert cibillst;
        }catch(Exception e){
            system.debug('==Exp=='+e);
        }
    }
    global void finish(Database.BatchableContext BC) {
    }
}

Hi Gurus, 

I have a Visualforce page for a Survey form that saves entry in to a custom object (Survey) in Salesforce. Within this VF page, I have images of different countries flags which are links to the same survey but in a different language. i.e the french flag with be a link to another VF page but will be the same survey but in french.

Now my problem is that when the flag is click and goes to the different language page, the Survey ID in the web address bar is removed therefore the entry wouldnt be saved into the correct place in Salesforce.

So does any one please know I can transfer the ID from one VF page to another?

This is the Div Class for my UK Flag linking to the english version;
<div class="UK_Flag">
                   <a href="/apex/CustomerSatisfaction_EN"><apex:image id="UK_Flag" value="
                   {!URLFOR($Resource.UK_Flag)}" /></a>
       	 </div>

This is my Apex Class for keeping the ID in the address bar after clicking on the UK Flag but its not working:
public with sharing class CustomerSurvey{
public CustomerSurvey() {

}
 public PageReference UK_Flag () {
           PageReference pageref = new PageReference('/apex/CustomerSurvey_UK'); 
           pageref.getParameters().put('recordID', 'a0C3E000001yarn' + ''); 
           pageref.setRedirect(true); return pageref;
           return pageref;
}

}

Please if anyone know how I can resolve this issue, please let me know please!
Thanks!
 
Hello All,
I have 3 objects  A,B,C.
A(Account) and B(Address)  have master details relationship, For One parent we can created upto 5 types of child,Example Address1,Address2 ,Address3 ,Address4 ,Address5.
Object C(VR) and A(Account) have master detail relationship.
In Object C I have a picklist field with values Address1,Address2 ,Address3 ,Address4 ,Address5., 
So take an example I will create an Account with  2 addresses records,
that is Address1 and Address2, now I have to write a logic on object C trigger, if in the picklist values if any user select other than these two address. I have to display an error.
Help me on this.
Thanks in advance.