• Jigar Trivedi
  • NEWBIE
  • 20 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 17
    Replies
Hi,

I am working on a functionality in which when an account is deactivated, I need to rollback collaboration permissions to contacts who earlier had it. I checked Box for Salesforce Developer Toolkit (https://developer.box.com/docs/box-for-salesforce-developer-toolkit) but was unable to find any method that does this job. Does anyone have any idea regarding this?
Hi,

I am facing a vf page exception while logging into community with a couple of users. It works with other users. The only exception that I am able to see is VF: /apex/Exception. Nothing else is shown. I already set up trace flag with the user I am logging in to community. Is there any other way to debug the vf page.
 
23:03:19.0 (29787899)|VF_EVALUATE_FORMULA_END
23:03:19.0 (29793681)|VF_EVALUATE_FORMULA_BEGIN|06631000004Zwup|#{NOT(ISPICKVAL($User.UserType,'Guest'))}
23:03:19.0 (29809758)|VF_EVALUATE_FORMULA_END
23:03:19.30 (30840830)|CUMULATIVE_LIMIT_USAGE
23:03:19.30 (30840830)|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 0 out of 100
  Number of query rows: 0 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 0 out of 150
  Number of DML rows: 0 out of 10000
  Maximum CPU time: 0 out of 10000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 100
  Number of Email Invocations: 0 out of 10
  Number of future calls: 0 out of 50
  Number of queueable jobs added to the queue: 0 out of 50
  Number of Mobile Apex push calls: 0 out of 10

23:03:19.30 (30840830)|TOTAL_EMAIL_RECIPIENTS_QUEUED|0
23:03:19.30 (30840830)|CUMULATIVE_LIMIT_USAGE_END

23:03:19.0 (30905948)|CODE_UNIT_FINISHED|VF: /apex/Exception
23:03:19.0 (31757330)|EXECUTION_FINISHED
23:03:19.32 (32709561)|CUMULATIVE_PROFILING_BEGIN
23:03:19.32 (32709561)|CUMULATIVE_PROFILING|No profiling information for SOQL operations
23:03:19.32 (32709561)|CUMULATIVE_PROFILING|No profiling information for SOSL operations
23:03:19.32 (32709561)|CUMULATIVE_PROFILING|No profiling information for DML operations
23:03:19.32 (32709561)|CUMULATIVE_PROFILING|No profiling information for method invocations
23:03:19.32 (32709561)|CUMULATIVE_PROFILING_END

 
I am new to Lightning and I am completing Lightning Components Developer Guide. Here, in client-side controller, there is a method 'setCallBack()' used to call the method in server-side controller. I Googled for the detailed explanation of this method but could not find anything. Can anyone explain the all possible parameters of the method and other usages. Here is a sample code from Developer Guide.
({
    "echo" : function(cmp) {
        // create a one-time use instance of the serverEcho action
        // in the server-side controller
        var action = cmp.get("c.serverEcho");
        action.setParams({ firstName : cmp.get("v.firstName") });

        // Create a callback that is executed after 
        // the server-side action returns
        action.setCallback(this, function(response) {
            var state = response.getState();
            // This callback doesn’t reference cmp. If it did,
            // you should run an isValid() check
            //if (cmp.isValid() && state === "SUCCESS") {
            if (state === "SUCCESS") {
                // Alert the user with the value returned 
                // from the server
                alert("From server: " + response.getReturnValue());

                // You would typically fire a event here to trigger 
                // client-side notification that the server-side 
                // action is complete
            }
            //else if (cmp.isValid() && state === "INCOMPLETE") {
            else if (state === "INCOMPLETE") {
                // do something
            }
            //else if (cmp.isValid() && state === "ERROR") {
            else if (state === "ERROR") {
                var errors = response.getError();
                if (errors) {
                    if (errors[0] && errors[0].message) {
                        console.log("Error message: " + 
                                 errors[0].message);
                    }
                } else {
                    console.log("Unknown error");
                }
            }
        });

        // optionally set storable, abortable, background flag here

        // A client-side action could cause multiple events, 
        // which could trigger other events and 
        // other server-side action calls.
        // $A.enqueueAction adds the server-side action to the queue.
        $A.enqueueAction(action);
    }
})

 
<apex:page id="pg" sidebar="false" showHeader="false" standardStylesheets="false" applyHtmlTag="false" 
    controller="MultipleSalarySlips" renderAs="{!if(isRender == true, "PDF", '')}">
    <html>
        <head>
        </head>
    <apex:form id="frm">
        <table style = "margin-left: 560px;border: 2px solid;padding: 19px;border-radius:5px;background-color:#f1d1bf;display:{!if(isRender == true, 'None','')}" id = "firstTable">
            <!--Table 1 code-->
        </table>
        

        <table style="width:100%;margin-top: 50px;border-collapse: collapse;page-break-after:always;">
                  <!--Table 2 code with repeate-->
        </table>
public with sharing class MultipleSalarySlips {
    public String selectedToMonth{get;set;}
    public String selectedFromMonth{get;set;}
    public String selectedToYear{get;set;}
    public String selectedFromYear{get;set;}
    public List<Monthly_Salary_Details__c> monthlySalaryDetails{get;set;}
    public List<WrpSalaryDetail> wrpSalaryDetails{get;set;}
    public Monthly_Salary_Details__c msd{get;set;}
    public Boolean isRender{get;set;}
    public static Integer iq = 1;
    
    public MultipleSalarySlips(){
        wrpSalaryDetails = new List<WrpSalaryDetail>();
        msd = new Monthly_Salary_Details__c();
        isRender = false;
    }


Hi,
I am facing very unusual and silly issue. I have a vf page with render as pdf based on a condition. The page contains two tables. I am hiding first table conditionally so that second table can generate with proper pdf format. Here is what should happen: On button click of first table a new tab should open and first table should be hidden and second table should be visible in pdf format. What happens is a new tab opens but first table does not get hidden as the condition (isRender remains false) remains true. Above is the code for more understanding.

 
I have created a custom button on a custom object.  The button, when clicked, opens up a Visualforce Page, in which the Lightning Component is placed:
<apex:page docType="html-5.0" standardController="Business_Request__c" extensions="BusinessRequest_BRtoCaseController" showHeader="false" sidebar="false" standardStylesheets="false">
    <apex:stylesheet value="{!URLFOR($Resource.SLDS260, '/styles/salesforce-lightning-design-system.min.css')}"/>    
    <apex:includeScript value="{!$Resource.jQuery331}"/>
    <apex:includeLightning />    
    <apex:outputPanel layout="block">
        <div id="lightning"/>
    </apex:outputPanel>
    
    <!--Lightning Component--> 
    <script>
    
        var base = location.protocol+"//"+location.hostname+(location.port && ":"+location.port);
        var brRecordId = "{!recordId}";
        
        $Lightning.use("c:BusinessRequest_BRtoCaseDependencyApp", function() {
            $Lightning.createComponent("c:BusinessRequest_BRtoCase", 
                                       {
                                           recordId : brRecordId,
                                           baseUrl : base
                                       }, 
                                       "lightning", 
                                       function(component) {
                                       }); 
        });
    </script>
</apex:page>

The component (for which I cannot post the code, sorry) consists of a Lightning Design System modal, with a lightning:recordEditForm inside of it.  Once the form is filled out and saved, the Apex controller creates a related record and passes a success/fail boolean to the Lightning Helper.  

In the Helper I have the code written to show a Toast and automatically close the window after a timeout:
 
action.setCallback(this, function(response){
            var state = response.getState();  
            var caseCreated = Object.keys(response.getReturnValue())[0];
            var caseComCreated = Object.values(response.getReturnValue())[0];
               
            if(state === "SUCCESS" && caseCreated === "true" && caseComCreated === "true") {
                $A.util.addClass(component.find("messageType"),"slds-theme_success");
                $A.util.removeClass(component.find("successIcon"),"slds-hide");
                $A.util.removeClass(component.find("successMessage"),"slds-hide");
                this.showToastHp(component, true);
            }
}

(later in the code...)


       
    showToastHp : function (component, success){
        var $j = jQuery.noConflict();
        
        if(success){
                $j("#toastDiv").addClass('slds-show');
                $j("#toastDiv").removeClass('slds-hide');
            }
            else{
                $j("#toastDiv").addClass('slds-hide');
                $j("#toastDiv").removeClass('slds-show');
            }
        }

            setTimeout(function(){
                window.close();
            },4500);
    }

Now, the window itself closes just fine.  However, I need something else to happen as well.  I need the record on which the button was pushed to refresh/reload.  I've tried many different Javascript methods, but the one I think may work is prohibited by lightning (uses the "opener" syntax).

Is there any way to do this?
Hi,

I am facing a vf page exception while logging into community with a couple of users. It works with other users. The only exception that I am able to see is VF: /apex/Exception. Nothing else is shown. I already set up trace flag with the user I am logging in to community. Is there any other way to debug the vf page.
 
23:03:19.0 (29787899)|VF_EVALUATE_FORMULA_END
23:03:19.0 (29793681)|VF_EVALUATE_FORMULA_BEGIN|06631000004Zwup|#{NOT(ISPICKVAL($User.UserType,'Guest'))}
23:03:19.0 (29809758)|VF_EVALUATE_FORMULA_END
23:03:19.30 (30840830)|CUMULATIVE_LIMIT_USAGE
23:03:19.30 (30840830)|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 0 out of 100
  Number of query rows: 0 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 0 out of 150
  Number of DML rows: 0 out of 10000
  Maximum CPU time: 0 out of 10000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 100
  Number of Email Invocations: 0 out of 10
  Number of future calls: 0 out of 50
  Number of queueable jobs added to the queue: 0 out of 50
  Number of Mobile Apex push calls: 0 out of 10

23:03:19.30 (30840830)|TOTAL_EMAIL_RECIPIENTS_QUEUED|0
23:03:19.30 (30840830)|CUMULATIVE_LIMIT_USAGE_END

23:03:19.0 (30905948)|CODE_UNIT_FINISHED|VF: /apex/Exception
23:03:19.0 (31757330)|EXECUTION_FINISHED
23:03:19.32 (32709561)|CUMULATIVE_PROFILING_BEGIN
23:03:19.32 (32709561)|CUMULATIVE_PROFILING|No profiling information for SOQL operations
23:03:19.32 (32709561)|CUMULATIVE_PROFILING|No profiling information for SOSL operations
23:03:19.32 (32709561)|CUMULATIVE_PROFILING|No profiling information for DML operations
23:03:19.32 (32709561)|CUMULATIVE_PROFILING|No profiling information for method invocations
23:03:19.32 (32709561)|CUMULATIVE_PROFILING_END

 
I have a controller with wrapper class in it..can someone help to to write test class for it??
My controller is:
public class ContactSelectClassController{

  public String beforeblob1{get;set;}
    public String conid{get;set;}
    public String emailEncoded { get; set; }
    public String email { get; set; }
    public String phoneEncoded { get; set; }
    public String con_number { get; set; }
    public String fullname{get;set;}
     public String emailName{get;set;}
    public String fullnameEncoded{get;set;}
    @TestVisible public List<wrapAccount> wrapAccountList {get; set;}
    public List<Contact> selectedAccounts{get;set;}
    public String feedid;
    private  List<Id> contactids=new list<Id>();
    public List<Contact> conts;
      public List<Contact> cont;
  
    public List<Feedback_Contacts__c> feedcon{get;set;} 
    
      public ContactSelectClassController(ApexPages.StandardController controller) 
    {
      
    /*  conid = ApexPages.currentPage().getParameters().get('conid');
         system.debug('+++++++++CONID+++++++++'+conid);
         Contact con =[Select firstname,lastname,email,phone,id from contact where id=:conid];
         system.debug('+++++++++CON+++++++++'+con ); */
 
    }
    
    public ContactSelectClassController()
    {
        
        
 
         
     feedid= (ApexPages.currentPage().getParameters().get('fid'));
      emailName= (ApexPages.currentPage().getParameters().get('emailName'));
     fullnameEncoded = ApexPages.currentPage().getParameters().get('fullname');
       emailEncoded = ApexPages.currentPage().getParameters().get('email');
       phoneEncoded = ApexPages.currentPage().getParameters().get('con_number');
    system.debug('*********************Feedback id is :*********************************'+fullname+' '+email+' '+con_number+' '+feedid+' '+emailName);
     system.debug('*********************contactidscontactidscontactids:*********************************'+selectedAccounts);
           
        if(wrapAccountList == null)
         {
            wrapAccountList = new List<wrapAccount>();
            for(Contact a: [select Id, Name,Email,Phone from Contact])
             {
                wrapAccountList.add(new wrapAccount(a));
             }
         }
         
         
  
     }
   public pageReference CancelAction()
  {
    PageReference pr1 = new PageReference('/apex/FeedbackMainlist');
   
    pr1.setRedirect(true);
    return pr1;
  } 

    public void processSelected()
     {
     
     feedid= (ApexPages.currentPage().getParameters().get('id'));
     system.debug('+++++++FEEDID++++++++'+feedid);
        
          fullnameEncoded = ApexPages.currentPage().getParameters().get('fullname');
           system.debug('++++++++NAMEENCODED++++++'+fullnameEncoded );
              if(fullnameEncoded !=null || fullnameEncoded =='')
  {
  Blob bodyBlob1 =EncodingUtil.base64Decode(fullnameEncoded );
   fullname = bodyBlob1.toString();
   system.debug('++++++++fullname ++++++'+fullname);
  }
  else{
   fullname = ApexPages.currentPage().getParameters().get('fullname');
  }
  
    emailEncoded = ApexPages.currentPage().getParameters().get('email');
  
  if(emailEncoded !=null || emailEncoded =='')
  {
  Blob bodyBlob1 =EncodingUtil.base64Decode(emailEncoded );
  email = bodyBlob1.toString();
  }
  else{
   email = ApexPages.currentPage().getParameters().get('email');
  }
  
  phoneEncoded = ApexPages.currentPage().getParameters().get('con_number');
  if(phoneEncoded !=null )  
  { 
  Blob bodyBlob2 =EncodingUtil.base64Decode(phoneEncoded );
  con_number =bodyBlob2.toString();
  }
  else{
  con_number=ApexPages.currentPage().getParameters().get('con_number');
  } 
        
    selectedAccounts = new List<Contact>();
 
        for(wrapAccount wrapAccountObj : wrapAccountList)
         {
            if(wrapAccountObj.selected == true)
             {
                selectedAccounts.add(wrapAccountObj.acc);
                 
             }
         }
          
          for(Contact cont: selectedAccounts)
        {
           contactids.add(cont.Id);
        } 
        
        
       feedcon=new List<Feedback_Contacts__c>();
     
        for(Contact cont: selectedAccounts)
       {
       
        cont  =  [Select firstname,lastname,email,id,name,MobilePhone from Contact where id in :selectedAccounts  ];
     system.debug('+++++++++CONT++++++++++'+cont  );
        string fullname = cont.firstname + ' ' + cont.lastname; 
          if(fullname !=null && email!=null && con_number!=null )
       {
        Blob beforeblob = Blob.valueOf(fullname);
        EncodingUtil.urlEncode(fullname,'UTF-8');
     
        string email = cont.email;
        Blob beforeblob1 = Blob.valueOf(email); 
        EncodingUtil.urlEncode(email,'UTF-8');
   
           string con_number = cont.MobilePhone;
           Blob beforeblob2 = Blob.valueOf(con_number);
           EncodingUtil.urlEncode(con_number,'UTF-8'); 
        
        Feedback_Contacts__c fc=new Feedback_Contacts__c();
        fc.FeedbackContactName__c=cont.Id;
        fc.FeedBackNo__c=feedid;
        fc.test__c = EncodingUtil.base64Encode(beforeblob ) ;
        fc.Email__c = EncodingUtil.base64Encode(beforeblob1 ) ;
       fc.ConNumber__c= EncodingUtil.base64Encode(beforeblob2 ) ;
        
        feedcon.add(fc);
        
        }
         insert feedcon; 
         } 
        Messaging.MassEmailMessage mail = new Messaging.MassEmailMessage();
        mail.setTargetObjectIds(contactids);
        mail.setTemplateId('00X360000015j6P');
       Messaging.sendEmail(new Messaging.MassEmailMessage[] {mail});
     }
 
    public class wrapAccount {
        public Contact acc {get; set;}
        public Boolean selected {get; set;}
 
        public wrapAccount(Contact a) {
            acc = a;
            selected = false;
        }
    }
}
 
I am new to Lightning and I am completing Lightning Components Developer Guide. Here, in client-side controller, there is a method 'setCallBack()' used to call the method in server-side controller. I Googled for the detailed explanation of this method but could not find anything. Can anyone explain the all possible parameters of the method and other usages. Here is a sample code from Developer Guide.
({
    "echo" : function(cmp) {
        // create a one-time use instance of the serverEcho action
        // in the server-side controller
        var action = cmp.get("c.serverEcho");
        action.setParams({ firstName : cmp.get("v.firstName") });

        // Create a callback that is executed after 
        // the server-side action returns
        action.setCallback(this, function(response) {
            var state = response.getState();
            // This callback doesn’t reference cmp. If it did,
            // you should run an isValid() check
            //if (cmp.isValid() && state === "SUCCESS") {
            if (state === "SUCCESS") {
                // Alert the user with the value returned 
                // from the server
                alert("From server: " + response.getReturnValue());

                // You would typically fire a event here to trigger 
                // client-side notification that the server-side 
                // action is complete
            }
            //else if (cmp.isValid() && state === "INCOMPLETE") {
            else if (state === "INCOMPLETE") {
                // do something
            }
            //else if (cmp.isValid() && state === "ERROR") {
            else if (state === "ERROR") {
                var errors = response.getError();
                if (errors) {
                    if (errors[0] && errors[0].message) {
                        console.log("Error message: " + 
                                 errors[0].message);
                    }
                } else {
                    console.log("Unknown error");
                }
            }
        });

        // optionally set storable, abortable, background flag here

        // A client-side action could cause multiple events, 
        // which could trigger other events and 
        // other server-side action calls.
        // $A.enqueueAction adds the server-side action to the queue.
        $A.enqueueAction(action);
    }
})

 
Please help me for these questions:

1)A Hierarchy Custom Setting stores a specific URL for each profile in Salesforce.
Which statement can a developer use to retrieve the correct URL for the current user´s profile and display this on a Visualforce page?
A.{!$Setup.Url_Settings__c[Profile.Id].URL__c}
B.{!$Setup.Url_Settings_c.Instance[Profile.Id].URL__c}
C.{!$Setup.Url_Settings__c.URL__c}(Missed)
D.{!$Setup.Url_Settings__c[$Profile.Id].URL__c}
<apex:page id="pg" sidebar="false" showHeader="false" standardStylesheets="false" applyHtmlTag="false" 
    controller="MultipleSalarySlips" renderAs="{!if(isRender == true, "PDF", '')}">
    <html>
        <head>
        </head>
    <apex:form id="frm">
        <table style = "margin-left: 560px;border: 2px solid;padding: 19px;border-radius:5px;background-color:#f1d1bf;display:{!if(isRender == true, 'None','')}" id = "firstTable">
            <!--Table 1 code-->
        </table>
        

        <table style="width:100%;margin-top: 50px;border-collapse: collapse;page-break-after:always;">
                  <!--Table 2 code with repeate-->
        </table>
public with sharing class MultipleSalarySlips {
    public String selectedToMonth{get;set;}
    public String selectedFromMonth{get;set;}
    public String selectedToYear{get;set;}
    public String selectedFromYear{get;set;}
    public List<Monthly_Salary_Details__c> monthlySalaryDetails{get;set;}
    public List<WrpSalaryDetail> wrpSalaryDetails{get;set;}
    public Monthly_Salary_Details__c msd{get;set;}
    public Boolean isRender{get;set;}
    public static Integer iq = 1;
    
    public MultipleSalarySlips(){
        wrpSalaryDetails = new List<WrpSalaryDetail>();
        msd = new Monthly_Salary_Details__c();
        isRender = false;
    }


Hi,
I am facing very unusual and silly issue. I have a vf page with render as pdf based on a condition. The page contains two tables. I am hiding first table conditionally so that second table can generate with proper pdf format. Here is what should happen: On button click of first table a new tab should open and first table should be hidden and second table should be visible in pdf format. What happens is a new tab opens but first table does not get hidden as the condition (isRender remains false) remains true. Above is the code for more understanding.

 
Hello All, I was just wondering if I could get a sample code of using nested list i.e. example
List<List<Set<Integer>>> my_list_2 = new List<List<Set<Integer>>>();
Just wondering what will be usage of the nested lists (Any pros and cons) and how to add entities to nested list and get it back.

Thanks
Prady
What are merge triggers and when merge events occur and how to handle them?? 
  • April 05, 2015
  • Like
  • 0

I have spent all morning trying to get this to work, including looking at dozens of Google and SFDC posts.


I have a report that I want to be able to provide a date as a parameter for, and I want the user to be able to choose the date.


I created a (my first) VisualForce page to do this, after experimenting with many examples.  If you
have looked at DatePicker, you will know that there are issues with using a native datepicker for
a custom object field.

I was able to find an example that uses JQuery's datepicker, and that part of the page works fine.
The problem I am having is that I want the VF page to have a button that invokes the report, passing
the date as the parameter.

The URL for the report looks like this, and I can manually change the date and watch it work correctly:
        https://instance.salesforce.com/00Oo0000002qAb9?pv0=%2711/1/2014%27

In my VF page, the user data ends up in an input field named 'reportEndDate'.  I have tried to put this
into the action field of an apex commandButton (inside an apex form) as follows:

      <apex:commandButton value="Run Report" action="/00Oo0000002qAb9?p0={$reportEndDate}" />

This URL *does* go to my report page, but does not pass the date correctly.
I have tried every permutation of ways to get the output in the correct format, but after at least
5 hours of trying figured I would post this question.

I can post more of the code if necessary, but figured I would start here.

How can I get the output from the text field 'reportEndDate' to be the correct URL
for my report to work?

Thanks,

Mitch

 

 

Trying to follow the salesforce tutorial on Application essesntial excercise guide. By middle of the excercise it is asking to add a custom field to candidate object. I am not able to find the candidate object. I am guessing my setup is not right. What I am missing? 

Hi I have a vpage as follows..


<apex:outputLabel style="font-weight:bold;" value="Search By Branch Code" ></apex:outputLabel>
        <apex:inputText value="{!textData}"/>

 

Iam trying to pass this input textfield value(what ever i enter) to the controller by using getters and setters but iam not able to pass the value its passing  just anull value

 

Getters and setters as below

 

private String textdata = null;

    public String getTextData() { return textdata; }
    public void setTextData(String data) { textdata = data; }
 

 So Some one plz help me in passing myy in put field value to controller so that i want to use that value in my soql query

 

Eg:

CAF_Bank__c [] currentbanknames=[SELECT  Bank_Name__c FROM CAF_Bank__c  where Branch_Code__c=:textdata];

            So plz tell me with an example.............

 

       

 

                                                                                                    Thanks& Regards

                                                                                                          Anu...