• sandeep madhav
  • NEWBIE
  • 90 Points
  • Member since 2016

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 43
    Replies
Hi,
I have a little problem but I'm not able to find a solution.I'm trying to pass an array variable "d" from javascript to a variable "Value" in the apex controller. Here my code:
javascript:
function setVal(param){
    param =param.replace("[","");
    param =param.replace("]","");
    var mylist = new Array()
    mylist = param.split(',');
    alert(mylist);
    var d =new Array();
    for( var i = 0; i < mylist.length; i++ ){
    var appoggio = mylist[i].trim();
    var strAppoggio = document.getElementById( appoggio ).innerHTML;
    strAppoggio = strAppoggio.substring(strAppoggio.lastIndexOf("*") + 1, strAppoggio.lastIndexOf("+"));
    d.push(strAppoggio);              
   }
   afConMethod(d.join());  
   alert('dToString: ' + dToString);           
   }

visualforce:
<apex:commandButton value="Get" onclick="setVal('{!firstrow}');" reRender="output"/>
<apex:actionFunction name="afConMethod" action="{!MyConMethod}" >
<apex:param value="" name="theValue" assignTo="{!Value}" />

apex controller:
public List<String> values {get;set;}
private String Value = 'no';
   public void setValue(String n) {
        Value = n;
   System.debug('Set Passed in Value: '+ Value);     
    }
    public String getValue() {
   System.debug('Get Passed in Value: '+ Value);
        return Value;
       
    }
public void MyConMethod() {
        system.debug('Start');             
       convertStrToList(Value);
        
    }
 
    public void convertStrToList(String str) {
    String[] listToReturn = new List<String>();
    if(String.isNotBlank(str)) {
        for(String eachStr : str.split(',')) {
            listToReturn.add(eachStr);
        }
    }
    system.debug(listToReturn);
    }
The debug logs shows the message: Passed in value: null
I really don't understand what's going wrong. Why Value doesn't contain the array in d? Help me please
 
Hi everyone!
I'm studuing for my Platform Developer I exam and came across with a question that got me confused:

Which code block returns the ListView of an Account object using the following debug statement?
system.debug(controller.getListViewOptions());

A. ApexPages.StandardSetController controller = new ApexPages.StandardSetController([SELECT Id FROM Account LIMIT 1]);
B. ApexPages.StandardController controller = new ApexPages.StandardController(Database.getQueryLocator('select Id from Account Limit 1'));
C. ApexPages.StandardController controller = new ApexPages StandardController ( [SELECT Id FROM Account LIMIT 1);
D.ApexPages.StandardSetController controller = new ApexPages.StandardSetController(Database.getQueryLocator('select Id from Account Limit 1');

According to the source from where I got this question, the right answer is D. Ok, B and C is obviously wrong because of the StandardController instead of StandardSetController, but then I ran some tests in the anonymous block using these 3 syntaxes:

1)
ApexPages.StandardSetController controller = new ApexPages.StandardSetController([SELECT Id FROM Account]);
2) 
ApexPages.StandardSetController controller = new ApexPages.StandardSetController(Database.getQueryLocator('SELECT Id FROM Account'));

3)
ApexPages.StandardSetController controller3 = new ApexPages.StandardSetController(Database.query('SELECT Id FROM Account'));

And I found out that all of them work the same way when calling the "system.debug(controller.getListViewOptions());", the debug was exactly the same in all these 3 cases.
So what's the difference between these 3 syntaxes for instantiating a StandardSetController?
Are answers A and D both right or is there really a reason for D to be more correct than A?

I appreciate any help!!
Please find below code:
public class MyController {
        private final Account account;
               public MyController() {
                   account = [SELECT Id, Name, Site FROM Account
                   WHERE Id = :ApexPages.currentPage().getParameters().get('id')];
               }
        public Account getAccount() {
               return account;
        }
        
        public PageReference save() {
               update account;
               return null;
        }
   }

In above example is it possible to change the method name "save"?  I am new to the visualforce. Any help would be really appreciable.

Thank you..

Hi,

Iam Triggering an VF Template email alert by using workflow on "created, and any time it's edited to subsequently meet criteria".

But Unfortunitely Im getting below error.

 

System.DmlException: Insert failed. First exception on row 0; first error: TEMPLATE_NOT_FOUND, The record couldn't be saved because it triggered an email alert that failed. Please contact salesforce.com Customer Support

Any Idea??

Hi,

Can some one help, When live Agent reject chat invitation , i want to redirect user to specific custom page. 

Hi,

Iam Triggering an VF Template email alert by using workflow on "created, and any time it's edited to subsequently meet criteria".

But Unfortunitely Im getting below error.

 

System.DmlException: Insert failed. First exception on row 0; first error: TEMPLATE_NOT_FOUND, The record couldn't be saved because it triggered an email alert that failed. Please contact salesforce.com Customer Support

Any Idea??

I want to see Id as query string parameter in URL of my custom page. How can I get it and set it?
 
  • January 04, 2017
  • Like
  • 0
Our developer has run into a curious situation and isn't sure of the answer or where to turn (I've pointed him here...don't think he's posted) so I'm trying to help him move the ball forward.

When using Global Search on the normal Salesforce website, it does more of a fuzzy match so for example, if I search for "Company Name" I will get both of the following as a result:
1. "Company Name"
2. "Company, Name" (notice the addition lf the comma)

However, when he did the search via the API using this code: 
List<Account> existing = salesforceSoapService.findAccountsByName(reg.getName());

he would not get both results depending on what the search string was (searching with or without the comma only returned the record that also did or did not have the comma).

Thoughts?  Is there somewhere specific on the developer site where I can point him?

Thanks!


 
Hi Everyone

I just want to find out some thoughts.  Is a 60KB viewstate okay for a visulaforce page.  I have 6 apex:tabs and when the page is fully loaded with data I get a viewstate up to 60KB.

Should I fdesparately find ways to decrease this or could I continue with a phase 1 rollout?

Thanks and appreciate your input.

Wayne
HI Dev's,

Opportunity object : I have 1 lakh records, how to change ownership from one user to another user?


Thanks in Advance...

Regards,
Lakshmi

Hi All,

I have a requirement where in i need to display multiple attachments with the name and  links of the uploaded file in the vf page without reloading. The files are uploaded from chatter feed and  needs to reflect in the below "vf page" . The below page is used inside a iframe.

Below is the code for the vf page :

<apex:page controller="CTRL_USF" showHeader="true" extensions="CTRL_Attachments">
    <apex:sectionHeader title="Upload photo"/>
    <apex:form >
        <apex:pagemessages />
        <br/>
        <apex:outputText >
            <b>1. Select the photo</b>
        </apex:outputText><br/><br/>
        &nbsp; &nbsp; &nbsp;
        <apex:outputText >
            Click the
            <b>"Choose File"
            </b>to find the photo.</apex:outputText><br/><br/>&nbsp; &nbsp; &nbsp;
        <apex:inputFile title="Upload Photo" contentType="{!fileContent.ContentType}" value="{!fileContent.body}" fileName="{!fileContent.name}" id="file"></apex:inputFile>
        <br/><br/><br/>
        <apex:outputText >
            <b>2. Upload Photo</b>
        </apex:outputText><br/><br/>&nbsp; &nbsp; &nbsp;
        <apex:outputText >Click the
            <b>"Upload Photo"</b>
            button.</apex:outputText><br/><br/>&nbsp; &nbsp; &nbsp;
       <!-- <apex:commandButton value="Upload Photo" action="{!savePhoto}"/><br/><br/>-->
    </apex:form>
</apex:page>


Would be glad if someone can help me with this.

Thanks and Regards,

Bharath Kumar M

Trying to get my VisualForce blocks to display based on the selection.  If 'new user request' selected in request type field, then NewAccount block should show.  If any other value is selected in request type field, then Details block should show.  

-------------------------------------------------------------------------------------------------------
VF Page

<apex:page controller="EnhancementRequestControllerv2" cache="false" showHeader="false" sidebar="false" title="Enhancement Request">
    <apex:includeScript value="{!$Resource.Jquery}" />
    <style>
    span.pbSubExtra {
      display: none;
    }
    input.instructions{
      margin: 10px; 
      width: 100%;
      text-align: left;
      margin-left: auto;
      margin-right: auto;
    }
    input.labels{
      margin: 10px;
      width: 100%;
      text-align: right;
      margin-left: auto;
      margin-right: auto;
      font-weight:bold
    }
    </style>
    
    <apex:image id="logo" value="{!$Resource.logo}" /> 
    
    <div style="width: 700px; margin-left: 5px;">
        <Script>
            $(document).ready(function(){
            $('[id*=NewAccount]').hide();
            $('[id*=Details]').hide();
            $('[id*=Select_Record_Type]').change(recordtype);
  

            function followupFields(){
                 alert('Showing followup fields');
                 var param = $('[id*=Select_Record_Type]').val();
                 if(param='New User Access'){
                     $('[id*=NewAccount]').show();       
                     alert('NewAccountDetails');
                     } 
                 else $('[id*Details]').show().
                    }     
            }
        });   
           
        </Script>
    <apex:form >
          <!-- main form section -->
          <apex:pageBlock id="thePB" mode="edit" rendered="{!NOT(showConfirmation)}"  >
                     <apex:pageMessages />
                     <apex:pageBlockSection collapsible="false" columns="1" title="Request Submission Form">
                     </apex:pageBlockSection>
             
                     <apex:pageBlockSection columns="1">
          
                                <apex:pageBlockSectionItem >
                                         <apex:outputPanel layout="block" styleClass="instructions">
                                                   <apex:outputLabel value="What is your request for the team?"  />
                                         </apex:outputPanel>
                                </apex:pageBlockSectionItem>
                   </apex:pageBlockSection> 
            
                   <apex:pageBlockSection columns="1">
                     <apex:pageBlockSectionItem >  
                            <apex:outputLabel value="{!$ObjectType.Enhancement_Request__c.Fields.Request_Type__c.Label}"  />
                            <apex:inputField id="Select_Record_Type" value="{!er.Request_Type__c}" style="width: 350px; height: 30px;" onchange="change();" />  
                     </apex:pageBlockSectionItem>
                      <br />
          </apex:pageBlockSection>
          
          <apex:pageBlockSection columns="1" id="NewAccount">
                    <apex:pageBlockSectionItem > 
                            <apex:outputPanel layout="block" styleClass="instructions">
                                <apex:outputLabel value="Please provide details of the new user account requested."  />
                            </apex:outputPanel>
                    </apex:pageBlockSectionItem>  
                  <apex:pageBlockSectionItem >
                        <apex:outputLabel id="showlabel" value="{!$ObjectType.Enhancement_Request__c.Fields.First_Name_New__c.Label}" />
                        <apex:inputField value="{!er.First_Name_New__c}" style="width: 350px;"/>  
                    </apex:pageBlockSectionItem>
                <apex:pageBlockSectionItem >
                        <apex:outputLabel id="showlabel" value="{!$ObjectType.Enhancement_Request__c.Fields.Last_Name_New__c.Label}" />
                        <apex:inputField value="{!er.Last_Name_New__c}" style="width: 350px;"/>  
                    </apex:pageBlockSectionItem> 
                    <apex:pageBlockSectionItem >
                        <apex:outputLabel id="showlabel" value="{!$ObjectType.Enhancement_Request__c.Fields.Email_New__c.Label}" />
                        <apex:inputField value="{!er.Email_New__c}" style="width: 350px;"/>  
                    </apex:pageBlockSectionItem> 
           </apex:pageBlockSection> 
             <apex:pageBlockSection columns="1" id="Details"> 
                  <apex:pageBlockSectionItem >  
                            <apex:outputLabel value="{!$ObjectType.Enhancement_Request__c.Fields.Details__c.Label}"  />
                            <apex:inputField value="{!er.Details__c}" style="width: 350px; height: 75px;" />
                  </apex:pageBlockSectionItem>
             </apex:pageBlockSection>
                      
             <br/>
              
             <apex:pageBlockSection columns="1"> 
                    <apex:pageBlockSectionItem >
                            <apex:outputPanel layout="block" styleClass="instructions">
                                    <apex:outputLabel value="Indicate the email account to receive notifications regarding this request."  /><br/>
                            </apex:outputPanel>
                    </apex:pageBlockSectionItem>
             </apex:pageBlockSection>
               <!-- submitter details  -->
             <apex:pageBlockSection columns="1"> 
                    <apex:pageBlockSectionItem >
                            <apex:outputPanel layout="block" styleClass="label">
                                    <apex:outputLabel value="Submitter Email"/>
                            </apex:outputPanel>
                            <apex:outputPanel layout="block" style="width: 100%; text-align: left; margin-left: auto; margin-right: auto;">
                                    <apex:inputField value="{!er.Email__c}" style="width: 350px;" />
                            <br/>
                            </apex:outputPanel>
                    </apex:pageBlockSectionItem>
               </apex:pageBlockSection>
                 
                 
            <!-- buttons section -->    
            <apex:pageBlockSection columns="1" collapsible="false" showHeader="false">
                    <apex:pageBlockSectionItem >
                            <apex:outputPanel layout="block" style="margin: 10px; width: 100%; text-align: center; margin-left: auto; margin-right: auto;">
                                    <apex:commandButton action="{!submitRequest}" value="Submit Request" />
                                    <apex:commandButton value="Clear" onclick="window.location.href=window.location.href; return false;"/>
                            </apex:outputPanel>
                    </apex:pageBlockSectionItem>
            </apex:pageBlockSection>
      </apex:pageBlock>
    
      <!-- confirmation message, only renders when request is submitted -->
      <apex:pageBlock mode="edit" rendered="{!showConfirmation}" id="pb_conf" >
                <apex:pageBlockSection columns="1" title="Enhancement Request">
                    <apex:outputPanel layout="block" style="margin-bottom: 5px;">
                        Your request has been submitted and is being processed. You should receive an email confirmation regarding your submission.  
                    </apex:outputPanel>
                </apex:pageBlockSection>
      </apex:pageBlock>
    
    </apex:form>
    </div>
</apex:page> 
------------------------------------------------------------------------------------------------------------------------------------------------------------------

Here is the controller, though it is not used for much:


public with sharing class EnhancementRequestControllerv2 {

    /*Constructors*/
    public EnhancementRequestControllerv2(){
    } 
    
    /*VF Page block render variable*/
    public Boolean showConfirmation { 
    set;
    get {
      if (showConfirmation == null)
          showConfirmation = false;
      return showConfirmation;
          }
    }

    
    /*  New Request */
    public Enhancement_Request__c er {
      get {
          if (er == null)
              er = new Enhancement_Request__c();
          return er;          
      }
      set;
    }
    
    /*Submission Logic*/
    public PageReference submitRequest() {
        
            /*General Field Validations*/
            //if (Util.isBlank(er.Email__c)) Util.addPageError('Please provide an email address.');
            
           /*Get submitter info through email address entered*/
           list<User> currentUserLst = new List<User>(); 
           currentUserLst = [Select id, firstname, lastName, email from User Where email =: er.Email__c limit 1];   
        
          
        IF(!currentUserLst.isEmpty()){
            /*If email matches  User*/
            try{
                /*Add user to practitioner field */
                er.Practitioner__c = currentUserLst[0].id;
                er.Email__c = currentUserLst[0].email;
                /*Indicate intake channel*/
                er.Form_Channel__c = TRUE;
                /*Hide submission page; show confirmation page*/
                showConfirmation = true;
                insert er;
                /* updated for automate approval */
                Approval.ProcessSubmitRequest sApprovalProcess = new Approval.ProcessSubmitRequest();
                sApprovalProcess.setComments('Submitted for Approval');
                sApprovalProcess.setObjectId(er.Id);
                Approval.ProcessResult result;
                result = Approval.process(sApprovalProcess);                
             }
            catch(DmlException ex){
                ApexPages.addMessages(ex);
             }
         
        }  
        /*If email does not match a user */
        ELSE{ 
            Util.addPageError('Your email address does not match a  account on file.  Please reverify or reach out to an admin.');
        }
        return null;
      
    }
   
}
Shipping VFPage:
<apex:page controller="Diffrectypes"> <apex:pageBlock title="VFPage1"> <apex:pageBlockSection title="VFPageSection1"> </apex:pageBlockSection> </apex:pageBlock>


MarketingVFPage
<apex:page controller="Diffrectypes"> <apex:pageBlock title="VFPage1"> <apex:pageBlockSection title="VFPageSection1"> </apex:pageBlockSection> </apex:pageBlock>


SalesVFPage
<apex:page controller="Diffrectypes"> <apex:pageBlock title="VFPage1"> <apex:pageBlockSection title="VFPageSection1"> </apex:pageBlockSection> </apex:pageBlock>


I want to create a controller with a method to call vfpage based on recordtype. when recordtype is selected and continue button is clicked . but I am not sure how to do it. how can I achieve it.
Hi All,

Iam trying to referesh the page on click of button in detail page. I tried with the following script but get an popup error and iam getting the result finally but popup should be removed.So can any one help me on this issue.

Script:
{!REQUIRESCRIPT("/soap/ajax/20.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/20.0/apex.js")} 

var myJob = new sforce.SObject("Opportunity"); 
myJob.Id = "{!Opportunity.Id}"; 
myJob.check__c= "true"; 
var result = sforce.connection.update([myJob]); 
setTimeout(document.location.reload(true),60000); 
document.reload(true);User-added image

I would like to customize the article type layout that is used when a Knowledge article is viewed in a community.

I know how to do this for the standard Knowledge interface in Salesforce, but not in communities.  Can anyone point me to documentation or let me know how to get started?

Thanks,
Jenna

I have an VisualForce page set up like this:
<apex:actionPoller interval="5" reRender="panel" action="{!getPanelRecords}"/>

<apex:outputPanel id="panel">
    <button onClick = "btnClick(this,'blue');" value="Change me blue"/>
    <button onClick = "btnClick(this,'red');" value="Change me red"/>
</apex:outputPanel>

<script>
    function btnClick(element, color) {
        this.attr('color', color);
    }
</script>

When I click the button, it will change color, But due to the panel getting rerendered, it will not persist between refreshes.

I was thinking of using the actionPoller onComplete event to get a list of id's and set the colors accordingly, but I'm not sure if there's an easier/better way to achieve this.

Can anybody recommend how to store the changed CSS on multiple elements between refreshes?
Hi All, 

I have a requirement where i need to get the id of a field in case layout using VF Page as sidebar component in the service console.
I have created a VF page and added a javascript in it.
Below is the javascript code:
var fId = parent.document.getElementById('frameId');
frameId is the Id of the case layout IFRAME.

In the browser console i am getting below error
Blocked a frame with origin "https://****.visual.force.com" from accessing a cross-origin frame.

I have checked and found out this related to "Same Origin Policy"
http://stackoverflow.com/questions/3076414/ways-to-circumvent-the-same-origin-policy

How can we overcome this in VF Page??
 
Hi friends the below code is VFpage code , I was created Homepage VF component and added in home Layout , but it is not redirecting to that specific link i dont know why, can any one help on yhis ... ASAP,actually the Href link is report link

<apex:page >
<script>
location.href="https://cs31.salesforce.com/00Op0000000GwfT";
 </script>
</apex:page>
I have a visualforce page that uses apex:pageblocks, apex:pageblocksections, and apex:pageblocksectionitems all wrapped in an apex:form tag.

Within one of the apex:pageblocksectionitems, I am displaying an apex:inputfield whose value is bound to a long text area field on the object. When the page loads, if I assign the long text area field a value from an action on the controller and then rerender the apex:inputfield, the value displays normally with carriage returns preserved and normal whitespace.  However, if I do some other action that rerenders the parent apex:form tag, all of a sudden the apex:inputfield value no longer displays with carriage returns on subsequent actions that only rerender the apex:inputfield.

Anyone have any ideas on why I'm getting this behavior?



 

Hi all,

 

Im newbie in force.com, and i have a question, my question is that: i want to export list of object into CSV file using Apex. So please help me how to do this?

 

Thanks,