• Sergio Alcocer
  • NEWBIE
  • 100 Points
  • Member since 2016

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 1
    Likes Given
  • 0
    Questions
  • 21
    Replies
Hi Every One 

Pls help Me the question 

I have a batch class that batch class should not run Saturdays and Sundays and consider as public holidays(like Diwali) how to achieve this ? 
Pls give me the solution ?
Hi friends,

As you know SF won't support TLS 1.0 soon and i have an issue about this.

I have 3 invenroments 'live site', 'staging' and localhost and i checked TLS version on livesite and staging. They support TLS 1.2, 1.1 and 1.0 but i'm not sure what TLS verstion will be used. Can someone help me to resolve my questions ?

1. The highest version will be used. Is it right?
2. Can i check what IP is using TLS 1.0 to connect to SF ?

Thank you so much !
My controller:
public class AccountEditController {
   
    accountwrapper1 makeEdit;
    List<accountwrapper1> listAccount = new List<accountwrapper1>();
    List<Account> selectableAccount = new List<Account>();
    List<Account> selectableAccount2 = new List<Account>();
    public Boolean showPopUp { get; set; }
   
   public AccountEditController() {
          showPopUp = False;
   }
    
    public List<accountwrapper1> getAccounts() {
            for(Account a: [SELECT Id, Name, BillingCountry, Phone FROM Account])
            listAccount.add(new accountwrapper1(a));
            return listAccount;            
    }
    
     public PageReference showToPopUp() {
        showPopUp = True;
         selectableAccount.clear();
        for(accountwrapper1 accwrapper : listAccount)
        if(accwrapper.selected == True)
        selectableAccount.add(accwrapper.acc);
        system.debug(selectableAccount);
        return Null;
    }
    
    public string BillingCountry {
        get; 
        set;
    }
    
    
    public PageReference Savemeth() {
        for(account acc :selectableAccount ) {
                acc.BillingCountry = BillingCountry;
                  selectableAccount2.add(acc);
        }    
    update selectableAccount2;
    return Null;
    
    }
    
    public PageReference cancelmeth() {        
        return Null;
    }

    public PageReference GetSelectedAccounts()
    {
       if(selectableAccount.size()>0) {
        system.debug(selectableAccount.size());
        system.debug(selectableAccount);
       return Null;
        }
        else
        return Null;
    } 
    
    
     public class accountwrapper1
    {             
        public Account acc{get; set;}      
        public Boolean selected {get; set;}
        public accountwrapper1(Account a)
        {
            acc = a;
            selected = False;
        }
    }
}

It's produce the error :Compile Error: unexpected token: 'showPopUp' at line 61 column 8

And my Page:
<apex:page controller="AccountEditController" applyHtmlTag="true">
    <apex:form >
        <apex:pageBlock Title="List of Accounts" >
           
               <apex:pageBlockButtons >
                    <apex:commandButton value="Get selected Records" action="{!showToPopUp}" rerender="Output" id="button"/>
               </apex:pageBlockButtons>
               
             <!-- {!showPanel}---->
                  <apex:outputPanel id="Output" >
                       <apex:outputPanel rendered="{!showPopUp}">
                       <!---{!showPanel}---------->
                           <apex:outputLabel value="BillingCountry: "></apex:outputLabel>
                           <apex:inputText id="BillingCountry" value="{!BillingCountry}" size="40" style="height:13px;font-size:11px;"/>                   
                           <apex:commandButton value="save" action="{!Savemeth}"/>
                           <apex:commandButton value="cancel" action="{!cancelmeth}"/>
                      
                        </apex:outputPanel>                   
                    </apex:outputPanel>  
                
               <apex:pageBlockSection Title="List of Available Accounts" columns="1" collapsible="false">
                        <apex:pageblockTable value="{!accounts}" var="a" >
                        
                            <apex:column headerValue="Select" width="60">
                                <apex:inputCheckbox value="{!a.Selected}" id="checkedone" />
                            </apex:column>
                            
                            <apex:column headervalue="Account Name" value="{!a.acc.Name}" width="200"/>
                            <apex:column headervalue="Phone" value="{!a.acc.Phone}" width="300"/>
                            <apex:column headervalue="Billing Country" value="{!a.acc.BillingCountry}" width="300"/>
                                              
                        </apex:pageblocktable>
               </apex:pageBlockSection>
                
        </apex:pageblock>
    </apex:form>
</apex:page>

I don't get any error but there is no pop up window is to be generated for the  entering the billingcountry of the text box and the save / cancel  button. so please help me to solve that case for answers thanks in  advance.  
Hello All, 

I am overriding standard Account layout with custom visual force page. I have used the following code for chatter in my code.

<apex:tab label="Chatter Feed" name="Chatter" id="Chatterfeed"><apex:outputPanel > 
      <chatter:feed entityId="{!$CurrentPage.parameters.Id}" /></apex:outputPanel>
      </apex:tab>

I am facing an issue in chatter post and i am unable to post anything. i click the post link but nothing happens. Can you please help ? 

Thanks

Raja
Hi Every One 

Pls help Me the question 

I have a batch class that batch class should not run Saturdays and Sundays and consider as public holidays(like Diwali) how to achieve this ? 
Pls give me the solution ?
Hi eveyone,
I want to remove the default '--None--' value form the picklist field in my custom vfpage. I have used the script to remove none form the picklist filed.
<script type='text/javascript' src= '//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js'>
        </script>
        <script language="javascript">
            $(function() {       
                $('select.RemoveNone option[value=]').remove();    
                  $(".usstates").hide(); 
                  
            });
        </script>

But it's not removing for custom fields. Can any one help me over here.

regards,
Suneel.
function nextRec(){
        
            
             alert('hii');
        
            if(localStorage['CycleAccounts']){
            var cycleAccounts = localStorage['CycleAccounts'].split(',');
            alert(cycleAccounts);
            alert('{!Account.Id}');
            var accId='{!Account.Id}';
            accId= accId.substring(0, accId.length - 3);
            alert(accId);
           // var currentAccountPos = cycleAccounts.indexOf('{!Account.Id}');
           var currentAccountPos = cycleAccounts.indexOf(accId);
            alert(currentAccountPos);
            
            if(currentAccountPos == cycleAccounts.length - 1){
            alert('This was the Last Account!');
            }
            else{
            
            parent.parent.frames.location.replace('/apex/accExample?id='+ cycleAccounts[currentAccountPos + 1]); 

            }
            }
                   
        
        }

Hi All,

1. If i login as a admin, browser gets refreshed with the updated id's
2.If i login with user other than admin, browser doesn't get refreshed.

Can somebody help me, It's very urgent.

TIA
Hi All, I wanted to query 1 year ahead lead records based on CreatedDate  i tried using Last_N_days and Next_N_days but it is not working.. any suggestions from your end.

Quick reply helps me to use it in my code.

Thanks
Sayyed
Hi,

I am trying to use a component as a modal dialog in an existing VF page with JQuery. I am having problems conditionally displaying the dialog and closing it properly again. I have used "rendered" with a boolean to determine whether to display the component, but am having problems when the modal is closed because the boolean is still set to true when the window is closed

Here is the page containing the component:
<apex:page Controller="DemoModalController">
	<apex:form >
		<h1>Demo Modal</h1>
		<p>Now is the time for all good men to come to arms</p>
		
		<apex:pageBlock id="theDialog" >
			<apex:commandButton value="Open Dialog"
		        		     	action="{!openDialog}" 
		            		 	title="Open the modal dialog"
		            		 	rerender="theDialog"/>
		    <br />
			<apex:commandButton value="Show displayDialog Value"
			       		     	action="{!showDisplayDialog}" 
			           		 	title="Show the value of displayDialog"/>

			<apex:outputPanel id="theDialog" rendered="{!displayDialog}" >
				<c:DemoDialog showDialog="{!displayDialog}" />
			</apex:outputPanel>
		</apex:pageBlock>

	</apex:form>

</apex:page>
And the controller
public with sharing class DemoModalController {

	public boolean displayDialog {get; set;}
	
    public DemoModalController()
    {
    	displayDialog = false;
    }
	
    public PageReference openDialog()
    {            		
		displayDialog = true;
	    return null;      
    }

    public PageReference showDisplayDialog()
    {
	    return null;      
    }	
}

And here is the component
<apex:component controller="DemoDialogController">

	<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js" />
	<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.0/jquery-ui.min.js" />
	<apex:styleSheet value="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.0/themes/smoothness/jquery-ui.css" />

    <apex:attribute name="showDialog"
    				assignTo="{!displayDialog}"
    				description="Should the dialog be shown?"
                    type="boolean"
                    required="true"/>
                     
    <div id="dialog">
    
        <apex:pageMessages />

		<p>This dialog box has been created using a jQuery visualforce component!</p>
        
		<apex:commandButton value="No Nothing"
		       		     	action="{!doNothing}" 
		           		 	title="Do nothing"/>
		           		 	
		<apex:commandButton value="Close Dialog"
		       		     	action="{!closeDialog}" 
		       		     	onClick="closeTheDialog()"
		           		 	title="Close the modal dialog"/>

    </div>
	    
    <script type="text/javascript">
     
	var $j = jQuery.noConflict();
	    
        $j(document).ready(function(){
            $j("#dialog").dialog(
            {
                title: '<Dialog Title here>',
                width: 700,
                height: 700,
                modal:true,
                closeable:false,
                resizable:false,
                draggable:true
            });
        }); 
 
        function closeTheDialog()
        {
            $j('#dialog').dialog('close');
        }
            
    </script>

</apex:component>

And the component controller
public with sharing class DemoDialogController {

	public boolean displayDialog;
	
	public boolean getDisplayDialog() {
		return displayDialog;
	}
	
	public void setDisplayDialog(boolean argDisplayDialog) {
		displayDialog = argDisplayDialog;            	
	}	


    public PageReference doNothing()
    {
    	displayDialog = false;
	    return null;  
    }
	    
    public PageReference closeDialog()
    {
    	displayDialog = false;
	    return null;      
    } 
    
}

I think I have 2 ways of trying to solve this problem:

1. FInd another way to conditionally display the modal windor

OR

2. Update the boolean value in the component so that it is recognised by the controller

Any help greatly appreciated.


 
Hello,

How do I get the feed based layout for Chatter in a visualforce page?

I'm working around with Visualforce for the first time, and created the Tabbed Account page they talk about in the manual.

How do I get it to show a chatter tab? like there is when using a feed based layout.

Please suggest me.

Regards,
Prabhat
Dear All, plz suggest,
I have created a new custom object in UAT called " Quotation". I need to make a Master-Detail relationship ( Quotation object as master) with another object as child called " Transaction". Now, as MD relationship i need to create in child object only, I need to create in " Transaction" object. I cant create it , as of now as records are present ( its showing error, as records present and disable the MD relationship option).
In UAT , i can delete all records ( around 2500) and till create a master detail, But what if when i deploy it to production ? as in Production we have many records present which we cant at all delete. Is that while it will show errors while deploying or it can take ?
I want a particular Master -details relnship becaause we want to see all the " Transaction" object current and past histories in the " Quotation" object. is there any other way for this visibility if we dont have the MD relationshop ? Thanks
Hi friends,

As you know SF won't support TLS 1.0 soon and i have an issue about this.

I have 3 invenroments 'live site', 'staging' and localhost and i checked TLS version on livesite and staging. They support TLS 1.2, 1.1 and 1.0 but i'm not sure what TLS verstion will be used. Can someone help me to resolve my questions ?

1. The highest version will be used. Is it right?
2. Can i check what IP is using TLS 1.0 to connect to SF ?

Thank you so much !
why Cant you do a dml in constructor?
Hi Folks,

i have two custom fields in both account and conatct i,e state and city now i want to make auto populate for those fields in contact when i try to create new contact in related list.
My controller:
public class AccountEditController {
   
    accountwrapper1 makeEdit;
    List<accountwrapper1> listAccount = new List<accountwrapper1>();
    List<Account> selectableAccount = new List<Account>();
    List<Account> selectableAccount2 = new List<Account>();
    public Boolean showPopUp { get; set; }
   
   public AccountEditController() {
          showPopUp = False;
   }
    
    public List<accountwrapper1> getAccounts() {
            for(Account a: [SELECT Id, Name, BillingCountry, Phone FROM Account])
            listAccount.add(new accountwrapper1(a));
            return listAccount;            
    }
    
     public PageReference showToPopUp() {
        showPopUp = True;
         selectableAccount.clear();
        for(accountwrapper1 accwrapper : listAccount)
        if(accwrapper.selected == True)
        selectableAccount.add(accwrapper.acc);
        system.debug(selectableAccount);
        return Null;
    }
    
    public string BillingCountry {
        get; 
        set;
    }
    
    
    public PageReference Savemeth() {
        for(account acc :selectableAccount ) {
                acc.BillingCountry = BillingCountry;
                  selectableAccount2.add(acc);
        }    
    update selectableAccount2;
    return Null;
    
    }
    
    public PageReference cancelmeth() {        
        return Null;
    }

    public PageReference GetSelectedAccounts()
    {
       if(selectableAccount.size()>0) {
        system.debug(selectableAccount.size());
        system.debug(selectableAccount);
       return Null;
        }
        else
        return Null;
    } 
    
    
     public class accountwrapper1
    {             
        public Account acc{get; set;}      
        public Boolean selected {get; set;}
        public accountwrapper1(Account a)
        {
            acc = a;
            selected = False;
        }
    }
}

It's produce the error :Compile Error: unexpected token: 'showPopUp' at line 61 column 8

And my Page:
<apex:page controller="AccountEditController" applyHtmlTag="true">
    <apex:form >
        <apex:pageBlock Title="List of Accounts" >
           
               <apex:pageBlockButtons >
                    <apex:commandButton value="Get selected Records" action="{!showToPopUp}" rerender="Output" id="button"/>
               </apex:pageBlockButtons>
               
             <!-- {!showPanel}---->
                  <apex:outputPanel id="Output" >
                       <apex:outputPanel rendered="{!showPopUp}">
                       <!---{!showPanel}---------->
                           <apex:outputLabel value="BillingCountry: "></apex:outputLabel>
                           <apex:inputText id="BillingCountry" value="{!BillingCountry}" size="40" style="height:13px;font-size:11px;"/>                   
                           <apex:commandButton value="save" action="{!Savemeth}"/>
                           <apex:commandButton value="cancel" action="{!cancelmeth}"/>
                      
                        </apex:outputPanel>                   
                    </apex:outputPanel>  
                
               <apex:pageBlockSection Title="List of Available Accounts" columns="1" collapsible="false">
                        <apex:pageblockTable value="{!accounts}" var="a" >
                        
                            <apex:column headerValue="Select" width="60">
                                <apex:inputCheckbox value="{!a.Selected}" id="checkedone" />
                            </apex:column>
                            
                            <apex:column headervalue="Account Name" value="{!a.acc.Name}" width="200"/>
                            <apex:column headervalue="Phone" value="{!a.acc.Phone}" width="300"/>
                            <apex:column headervalue="Billing Country" value="{!a.acc.BillingCountry}" width="300"/>
                                              
                        </apex:pageblocktable>
               </apex:pageBlockSection>
                
        </apex:pageblock>
    </apex:form>
</apex:page>

I don't get any error but there is no pop up window is to be generated for the  entering the billingcountry of the text box and the save / cancel  button. so please help me to solve that case for answers thanks in  advance.  
I am updating a picklist value through API 37.0 using .net c#
It works fine, but if the user select another value in the picklist, the value I added is gone.

I can't find a property to save the value.

any suggestions ?
  • September 30, 2016
  • Like
  • 0
I have a Picklist named as "No of persons " which contains 1,2,3,...etc values.
I also have one multipicklist which contains name of persons.
so if i select 2 as no of persons then i want to restrict users to select exactly 2  values from multipicklist.
how to do this with validation rule or formula?

 
  • September 30, 2016
  • Like
  • 0
I'm currently working on creating a plugin which would allow its users to interact with their Salesforce accounts via REST API.
Since the code would be residing on end-user servers I cannot use the client_secret, so I figured that using the User-Agent flow is the thing I'm looking for.
The problem is, however, I cannot get the redirect to work, since I get a "redirect_uri_mismatch" error. It works if I specify the CallbackURL in my Connected App settings, but since this is a plugin that clients can install on their sites, I cannot know their URI's before hand.
Is it possible to allow any url to be a redirect_uri?
If not - what are my alternatives? I can't make the client secret safe.
I am trying to create a case external page that allows for me to use the standard controller with an extension so that they are able to add an attachment if they are wanting to. I had it where it wouldn't upload the attachment and now it will only upload the attachment and leaves all of the data alone. Anyone know of a way for it to do both?

VF Page:
<apex:page standardController="Case" extensions="caseattachment">
    <apex:form id="frm">
        <apex:pageBlock title="New Salesforce Case">
            <apex:pageBlockSection columns="1"  title="Salesforce Case -- Red lines represent required fields." collapsible="false">
            </apex:pageBlockSection>
            <strong>Please click the lookup icon (small button to right of field) to search name selection from Salesforce lookup dialog.</strong>
            <apex:pageBlockSection columns="1">
               <apex:inputField value="{!Case.Requestor_Name__c}" required="true"/>
               <br></br>
               </apex:pageBlockSection>
            <strong>Select Problem and High Priority ONLY if the issue is preventing you from continuing work in Salesforce.</strong>
            <apex:pageBlockSection columns="1">
               <apex:inputField value="{!Case.Type}" required="true"/>
               <apex:inputField value="{!Case.Priority}" required="true"/>
            </apex:pageBlockSection>
            <apex:pageBlockSection columns="1" title="Case Details" collapsible="false">
               <apex:inputField value="{!Case.Department__c}" required="true"/>
               <apex:inputField value="{!Case.Salesforce_Object__c}" required="true"/>
               <apex:inputField value="{!Case.Description}" required="true" style="width:50%; height: 60px" />
            </apex:pageBlockSection>
            <apex:pageBlockButtons >
               <apex:commandButton action="{!save}" value="Submit"/>
               <apex:commandButton action="{!cancel}" value="Cancel"/>
           </apex:pageBlockButtons>
        <apex:pageBlockSection title="Upload the Attachment" collapsible="false" dir="LTR" columns="1">
        <div id="upload" class="upload">                                   
            <apex:inputFile id="fileToUpload" value="{!fileBody}" filename="{!fileName}" styleClass="input-file"/>                            
        </div>
        </apex:pageBlockSection>
       </apex:pageBlock>
    </apex:form>
</apex:page>

Apex Class: 
public class caseattachment
{
public case objcase{get;set;}
public Attachment myAttachment{get;set;}
public string fileName{get;set;} 
public Blob fileBody{get;set;}

    public caseattachment(Apexpages.standardcontroller controller)
    {
        objcase = new case();
        myAttachment =new Attachment();
    }
    public pagereference save()
    {
        insert objcase;
        System.debug('@@@@@fileBody'+fileBody);     
        myAttachment  = new Attachment();
              Integer i=0;
              myAttachment .clear();
              myAttachment.Body = fileBody; 
              myAttachment.Name = 'Logo_'+objcase.id+'.jpeg' ; 
              myAttachment.ParentId = objcase.id;             
              insert myAttachment;                 
        pagereference pr = new pagereference('/'+objcase.id);                           
        return pr;
    }
}

Anyone know what I am doing wrong? 
 
Hi friends,

As you know SF won't support TLS 1.0 soon and i have an issue about this.

I have 3 invenroments 'live site', 'staging' and localhost and i checked TLS version on livesite and staging. They support TLS 1.2, 1.1 and 1.0 but i'm not sure what TLS verstion will be used. Can someone help me to resolve my questions ?

1. The highest version will be used. Is it right?
2. Can i check what IP is using TLS 1.0 to connect to SF ?

Thank you so much !