• Val Valino
  • NEWBIE
  • 219 Points
  • Member since 2013

  • Chatter
    Feed
  • 8
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 46
    Replies

 

This is a controller extension which has a custom save method to commit the value of userClick to the database. 

 

1. How do I test userClick 

2. How do I test the SelectOptions method of UserOption dropdown values.

 

 

 

Controller Extension for standardsetcontroller

 

public with sharing class BulkUpdate {

//Global Variables
private ApexPages.StandardSetController controller;

Public String userClick { get; set; }


// Standard Set Controller Constructor
public BulkUpdate(ApexPages.StandardSetController Controller) {

this.controller = controller;

}


public List<Case> getSelected(){
return (List<Case>) controller.getRecords();
}



//getOptions for userClick Method
public List<SelectOption> getUserOptions(){

List<SelectOption> useroptions = new List<SelectOption>();

useroptions.add(new SelectOption('','--select--'));
useroptions.add(new SelectOption('Next','Next RC'));
useroptions.add(new SelectOption('Next-Complete','Next-Complete'));
useroptions.add(new SelectOption('Previous','Previous RC'));
useroptions.add(new SelectOption('Refresh','Refresh Case'));


return useroptions;
}

 

//Save and Next method
public PageReference SaveNext(){


for(Case a :getSelected()){
a.UserActions__c=userClick;
}

Update getSelected();

PageReference pageRef = page.BulkUpdate2;
pageRef.setRedirect(true);
return pageRef;

}

}

 

 

 

 

 

Relevant Visualforce code:

 

<apex:selectList Label="UserActions" value="{!userClick}" size="1">
                     <apex:selectOptions Value="{!userOptions}"/>
                  </apex:selectList>

Good afternoon community, 

 

So on a Visualforce Email template I'm trying to add a link back to the record detail page, with:

 

<apex:outputLink value="{!URLFOR($Action.Lead.View, relatedTo.id)}">
</apex:outputLink>

 

where related to type is my standard Lead object.  on Saving this template i continue to get this error:

Error occurred trying to load the template for preview: Invalid parameter for function URLFOR. Please try editing your markup to correct the problem

 

I'm not a developer by trade so not sure how to correct this, would appreciate any feedback regarding how to fix ....

 

thanks everyone

Hello,

 

I have a VF page that I created on a custom object.  In that page, I am loading an image within a table.  The image is saved as a GIF file in my Documents object in SFDC.  Everything worked as it should in the past but I recently made a change to the image that is supposed to show and the code is still showing the prior image.  Does anyone know why this would be happening as the old image is not even in the Documents object anymore?  The line of code I am using is below.  Thanks,

 

<img src="/servlet/servlet.FileDownload?file=01570000001M9Vp" alt="Essential" title="Essential"/>

  • November 07, 2013
  • Like
  • 0

Hello, 

 

I am trying to make the header row static on the VF page, such that when the users scroll down the page the first row remains there and users are able to see the row data along with the Column headers (just like it happens in Excel when the top panes are frozen).

 

Can someone provide any pointers ? 

 

Thanks

Amit

 how do i create a search page with company and phone search field:
 
Vf page:
 

<apex:page tabStyle="Account" Controller="SDFindCustomer" id="FindCustomerPage" sidebar="true" showHeader="true" >

<apex:form id="FindCustomer">
<apex:outputPanel id="msgPanel">
<apex:pageMessages ></apex:pageMessages>
</apex:outputPanel>

<apex:pageBlock >

<apex:pageBlockSection id="NamePanel" columns="2">

<apex:outputLabel value="Company Name" for="cname" > </apex:outputLabel>
<apex:inputtext id="cname" value="{!companyName}" />
<apex:outputLabel value="phone No" for="phone" > </apex:outputLabel>
<apex:inputtext id="phone" value="{!phone}" />

</apex:pageBlockSection>
<apex:pageBlockButtons location="bottom">
<apex:commandButton action="{!findLeadsAndAccounts}" value="Find" ID="ENTER_BUTTON" />
</apex:pageBlockButtons>
</apex:pageblock>

</apex:form>

<apex:form id="accountListForm">

<apex:pageBlock >

<apex:pageBlockSection id="AccountPanel" >

<apex:outputPanel id="accTablePanel" >
<apex:pageblocktable value="{!accountList}" var="acc">
<apex:column headerValue="id" >{!acc.id}</apex:column>
<apex:column headerValue="Name" >{!acc.Name}</apex:column>
<apex:column headerValue="Phone" >{!acc.phone}</apex:column>
</apex:pageblocktable>
</apex:outputPanel>

</apex:pageBlockSection>
</apex:pageblock>

</apex:form>

</apex:page>

Hi,
 
I have created a checkbox field and am displaying it on a visualforce page using inputField.
 
However, the checkbox seems to appear on the right side after the field label. Is there a way to put the checkbox on the left side before the field label?
 
Thanks!
 

Hello,

 

Is there an easier way to structure where state = CA, OR, WA, ID, NV, AZ then Region = West ?

if state = ND, SD, NE, KS, OK, TX then Region = Central

 

I know in MS SQL by using the IN statement. For example:  In (ND, SD, NE, KS, OK, TX). However is there an equivalent coding structure in Apex code? Please advise.

 

Thanks

Paul

 

  • June 12, 2013
  • Like
  • 0

Can you give me sample code for opening a new webpage when I click on a image.

This is the image display:-

 

<apex:image url="{!URLFOR($Resource.Playbook_Resource, 'assets/css/img/bestPractice.png')}" onclick="javascript&colon;NewPage('{!object.pageurl}'/> 

 

I am storing the URL of the new image in the field object.pageurl

  • June 12, 2013
  • Like
  • 0

 

This is a controller extension which has a custom save method to commit the value of userClick to the database. 

 

1. How do I test userClick 

2. How do I test the SelectOptions method of UserOption dropdown values.

 

 

 

Controller Extension for standardsetcontroller

 

public with sharing class BulkUpdate {

//Global Variables
private ApexPages.StandardSetController controller;

Public String userClick { get; set; }


// Standard Set Controller Constructor
public BulkUpdate(ApexPages.StandardSetController Controller) {

this.controller = controller;

}


public List<Case> getSelected(){
return (List<Case>) controller.getRecords();
}



//getOptions for userClick Method
public List<SelectOption> getUserOptions(){

List<SelectOption> useroptions = new List<SelectOption>();

useroptions.add(new SelectOption('','--select--'));
useroptions.add(new SelectOption('Next','Next RC'));
useroptions.add(new SelectOption('Next-Complete','Next-Complete'));
useroptions.add(new SelectOption('Previous','Previous RC'));
useroptions.add(new SelectOption('Refresh','Refresh Case'));


return useroptions;
}

 

//Save and Next method
public PageReference SaveNext(){


for(Case a :getSelected()){
a.UserActions__c=userClick;
}

Update getSelected();

PageReference pageRef = page.BulkUpdate2;
pageRef.setRedirect(true);
return pageRef;

}

}

 

 

 

 

 

Relevant Visualforce code:

 

<apex:selectList Label="UserActions" value="{!userClick}" size="1">
                     <apex:selectOptions Value="{!userOptions}"/>
                  </apex:selectList>

Hi all,

 

I am displaying a custom UI of three sections on click of 'Edit' button.

 

Now I have to freeze(should not be editable but Viewable) all the fields in the first two sections and third section should be editable.

 

How can I achieve this?

 

R - Manu

I am trying to do something in Apex that I think is possible, but I cannot quite grasp how.

 

I have a parent object that has 5 fields.

Field_1__c

Field_2__c

Field_3__c

Field_4__c

Field_5__c

 

These five fields can be populated by "Red", "Yellow" or "Green".

 

The child object has a picklist where the values are the name of the five fields. 

Picklist__c:

Field 1

Field 2

Field 3

Field 4

Field 5

 

If the picklist is not null and one of the field names are selected(with other logic to determine color), I need to populate the corresponding field with the appropriate value.

 

I know somehow this can be accomplished through Dynamic SOQL, but am at a loss at this point. 

 

Please help.

 

Good afternoon community, 

 

So on a Visualforce Email template I'm trying to add a link back to the record detail page, with:

 

<apex:outputLink value="{!URLFOR($Action.Lead.View, relatedTo.id)}">
</apex:outputLink>

 

where related to type is my standard Lead object.  on Saving this template i continue to get this error:

Error occurred trying to load the template for preview: Invalid parameter for function URLFOR. Please try editing your markup to correct the problem

 

I'm not a developer by trade so not sure how to correct this, would appreciate any feedback regarding how to fix ....

 

thanks everyone

So previously, I was able to associate an externalId to a Lookup Field in my Contacts. I've used this in the past in Dev501 course and now it is not working and getting error.

 

Here is the code:

Account refAcc = new Account(ClientExternalId__c = 'test1234');
Contact c = new Contact (AccountId = refAcc, FirstName = 'test', LastName = 'testMe');
upsert c;

system.debug('what is my new contact id +++++++' +c.id);

 and here is the error i am receiving:

Invalid initial expression type for field Contact.AccountId, expecting: Id

 

I am so lost on what happen and curious if anyone else see this issue?

Hello,

 

I have a VF page that I created on a custom object.  In that page, I am loading an image within a table.  The image is saved as a GIF file in my Documents object in SFDC.  Everything worked as it should in the past but I recently made a change to the image that is supposed to show and the code is still showing the prior image.  Does anyone know why this would be happening as the old image is not even in the Documents object anymore?  The line of code I am using is below.  Thanks,

 

<img src="/servlet/servlet.FileDownload?file=01570000001M9Vp" alt="Essential" title="Essential"/>

  • November 07, 2013
  • Like
  • 0

Hello, how are you ?!?!?

Well, I'm having a problem with my code. I'm trying to do a table with dynamics columns. But to each line I have differents registers. Look down:


 apex:form >
   apex:pageBlock >
      apex:pageBlockTable value="{!listFuncionario}" var="func">

          apex:column headerValue="Funcionario">
                 apex:outputField value="{!func.name}"/>
           /apex:column>

           apex:repeat value="{!staffGet(func.name)}" var="eachDay">
                      apex:column headerValue="{!eachDay.Diad__c}">
                                 apex:inputField value="{!eachDay.Diad__c}"/>
                      /apex:column>
           /apex:repeat>

       /apex:pageBlockTable>

    /apex:pageBlock>
/apex:form>

public List<Dia__c> staffGet(String name){ 
      List<Dia__c> days;
      days = [select id, name, Diad__c, FuncionarioPai__r.name from Dia__c where FuncionarioPai__r.name = :name];
      return days;
}

 


Finally, my problem is in this line: <apex:repeat value="{!staffGet(func.name)}" var="eachDay">

The error message is this: Unknown function staffGet. Check spelling.

I don't know how to solve this problem !!! :-(        

Somebody can help me ?!?!
Thank you so much !!!!!

  • November 07, 2013
  • Like
  • 0

Hi

 

I Need to remove duplicate values from a list .I used the following code but still the values in the list are not removed and I get the original list itself.

 

--here Catalogue is my Object

 

Set<SITEdu__Catalog__c>  CaAg = New Set<SITEdu__Catalog__c>();
List<SITEdu__Catalog__c> CaAgListresult = new List<SITEdu__Catalog__c>();
List<SITEdu__Catalog__c> CaAgList = new List<SITEdu__Catalog__c>();
public List<SITEdu__Catalog__c> getStudentAgView()
 {
    CaAgList = [select SITEdu__CatalogType__c from SITEdu__Catalog__c];  
    
    CaAg.addAll(CaAgList);
    CaAgListresult.addAll(CaAg);
    return CaAgListresult;
  }

 

 

Could someone please guide me in getting this done.

 

Thanks in Advance,

 

Regards,

Christwin

Hello, 

 

I am trying to make the header row static on the VF page, such that when the users scroll down the page the first row remains there and users are able to see the row data along with the Column headers (just like it happens in Excel when the top panes are frozen).

 

Can someone provide any pointers ? 

 

Thanks

Amit

Hello Helper

 

I want to embedd a visual force page into a section  of a custom object page layout

 

I  did it  but  I was surprised  to see that my  page  is not visible  in Edit mode  only after I save  the record

 

The visual force page  does not use any data of the cusotm object  it displays  soem record form another   

 

In order  to make the page available   in the page layout designer   I defined  the page as   below  (where "MyCustomObject"  is the object  where I have to display the VF page  but  as I mentioend the page does not use the record being edited/created )

 

<apex:page standardController="Coaching_Report_vod__c" extensions="VEEVA_CR_helper">

 

any suggestions are welcommed

 

 

Thanks  in advance

Csbaa

 

 

 

 
  • November 04, 2013
  • Like
  • 0

Dear all,

 

I am trying to pass visualforce report data to excel file .I have given page section as below

 

<apex:page sidebar="false" showHeader="false" contentType="application/vnd.ms-excel#Report.xls" cache="true" Controller="Thecontroller">

 

and corrosponding apex class

 

public pagereference FetchExcelReport()
    {
    Pagereference Reportpage = new PageReference('/apex/ExcelReport');
    Return Reportpage;
    }

 

whenever I am trying to save the code (with ctrl+s) on page editor its asking for saving report.xls file, and that file is containing textbox, picklist, and other fields from visualforce pages. while I want only report rows to be saved in excel and only when I click a export button on report page.

 

please suggest.

 

Thanks,

Manish.

 

 

I am getting an error "Too many soql queries" when there is update method as there is soql in for loop

 

Please help me in writing soql outside for loop

 

the code for this is 

 

trigger UpdateCallString on Call_String__C (after update) {

    set<Id> sUserId = new set<Id>();
    map<String,Integer> mapNewCallbyother = new map<String,Integer>();    
    List<Call_String__C> lstCallString = [select id, Account__r.Co_Owner__c, Account__r.Name, Original_CallString__c,Updated_CallString_plist__c from Call_String__C where id IN: trigger.newmap.keyset()];
    for(Call_String__C cl:lstCallString){ 
    Call_String__c oldval = Trigger.oldMap.get(cl.Id);
        if(cl.Account__r.Co_Owner__c != null && cl.Account__r.Co_Owner__c != ''){
            String[] arrOwnerid = cl.Account__r.Co_Owner__c.split(';');
            for(String str: arrOwnerid){
                if(str != null && str != ''){
                    sUserId.add(str.trim());                    
                }
            }
        }
       If(cl.Updated_CallString_plist__c!=null &&cl.Updated_CallString_plist__c!='')
       {
        mapNewCallbyother.put(cl.Account__r.Name,integer.valueOf(cl.Updated_CallString_plist__c));
       }
       else{
       mapNewCallbyother.put(cl.Account__r.Name,integer.valueOf(oldval.Original_CallString__c));
       }
    }
    List<Account> lstAccount = [Select Total_Calls_Formula__c,called_by_other__c , OwnerId, Co_Owner__c, Name from Account where ownerId IN: sUserId and Name in: mapNewCallbyother.keyset()];
   
    for(Account acc: lstAccount){
        String s='%' + acc.name+'%'; 
        String str = acc.Co_Owner__c; 
        List<String> sArr = str.split(';', 0);
        
        list<account> acclist = [Select name,OwnerId,Territory_Name__c,Total_Calls_Formula__c,(select Updated_CallString_plist__c,Original_CallString__c from Call_Strings__r) from account where ownerid!= :acc.Ownerid and name like :s and OwnerId in :sArr ];
         Integer totalothercall = 0;
        for(Account ac:acclist){
            system.debug('#######'+ac.Total_Calls_Formula__c);
            
            for(Call_String__c cs: ac.Call_Strings__r){
                if(cs.Updated_CallString_plist__c != '' && cs.Updated_CallString_plist__c!=null)
                totalothercall += integer.valueOf(cs.Updated_CallString_plist__c);
               else
               totalothercall += integer.valueOf(cs.Original_CallString__c);
              
            }
            //totalothercall += integer.valueOf(ac.Total_Calls_Formula__c);
        }
        acc.called_by_other__c = 0;
        acc.called_by_other__c = totalothercall;// + mapNewCallbyother.get(acc.Name);
    }
    if(lstAccount.size() > 0){
        update lstAccount;
    }
}