• Sivakumari2i
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 17
    Questions
  • 45
    Replies

hi,

 

I have some input field in my visualforce page.

 

If i click a command button, the values entered must be cleared automatically.

 

I tried this using javascript but i am not able to achieve the end result.

 

Please help me.

 

Regards,

S.Sivakumar.

Hi , i am using visualforce charting in my visualforce page.

 

By default i am getting blue color for the bars in charts.

 

Is there any way to change the color of the charts increase the label size?

 

Thanks,

S.Sivakumar

Hi,

 

Can anyone help me in writing test method for the following apex controller.

 

public with sharing class LookupPopupController
{
    public String query {get; set;}
    public List<Opportunity> opportunities {get; set;}
    public PageReference runQuery()
    {
        List<List<Opportunity>> searchResults = [FIND :query IN ALL FIELDS RETURNING Opportunity (id, name, StageName, Amount, CloseDate, FiscalQuarter, FiscalYear Where ForecastCategory IN ('Pipeline', 'Best Case') and CloseDate = THIS_FISCAL_QUARTER order by StageName)];
        Opportunities = searchResults[0];
        return null;
    }
}

 

Thank you,

S.Sivakumar

 

Hi,


I have a text in visualforce page. If the value is less than 100 then i have to change the font color to red and if it is greater than 100 then i have to change the font color to green.

 

I dont know how to achieve this.

 

Please explain me with some examples.

 

 

Thanks,

S.Sivakumar.

Hello,

 

Can someone help me with an idea in finding the average age of opportunities in each stage?

 

Thanks in advance

Hi,

 

I have a custom controller ( with sharing class is used)  and a visualforce page. I have some business logic in without sharing class.(i.e) I need some logic in with sharing class and some logic in without sharing class and both results are returned to the same visualforce page.

How to achieve this?

 

I tried with controller extension. But i face following problem
(i.e) i have a picklist in visualforce page and id is returned to with sharing class(custom controller). But i don know how to get that selected picklist id in the controller extension(without sharing class).

 

I also tried in creating inner class as without sharing inside outer class as with sharing. But i dont know how to access the methods in inner class and dont know how to return the value from inner class to visualforce page.

 

Please help me to resolve this issue.

Hi,

i dont know how to start, in writing test method for the below controller. Can anyone help me?

 

This is my controller:

 

public with sharing class picklistTest
{
    Map<String, String> mapSelectListValues = new Map<String, String>();
    public String selectedVal {get;set;}
    public String selectedLab {get;set;}
    public List<SelectOption> getOptions1()
    {
        List<SelectOption> retVal = new List<SelectOption>();
        List<AggregateResult> result = [Select Id, type, Number, CALENDAR_YEAR(StartDate)s from Period];
        retVal.add(new SelectOption('','-- Choose a Group --'));        
        for(AggregateResult a : result)
        {
          String c  = String.valueOf(a.get('type'));
          integer v = integer.valueOf(a.get('Number'));
          integer s = integer.valueOf(a.get('s'));
          retVal.add(new SelectOption(a.Id,c+' '+v+' - '+s));                 
        }
        for(Selectoption s: retVal)
        {
            mapSelectListValues.put(s.getValue(), s.getLabel());
        }
        return retVal;    
    }

   public List<PieWedgeData> getPieData()
    {
        List<PieWedgeData> data = new List<PieWedgeData>();
        for(AggregateResult ar :[Select Fiscal_Year(StartDate)fy, Fiscal_Quarter(StartDate)fq from Period where Id =: selectedVal group by Fiscal_Year(StartDate),Fiscal_Quarter(StartDate)])
        {
           integer year = integer.valueOf(ar.get('fy'));
           integer quat = integer.valueOf(ar.get('fq'));
           for(AggregateResult ar1 : [Select Count(Amount)tcnt from Opportunity where FiscalYear =: year and FiscalQuarter =: quat])
           {
                Integer cnt = integer.valueOf(ar1.get('tcnt'));
                data.add(new PieWedgeData('Created Opps',cnt));
           }
           
           for(AggregateResult ar2 : [Select Count(Amount)tcnt1 from Opportunity where FiscalYear =: year and FiscalQuarter =: quat and StageName = 'Closed Won'])
           {
                Integer cnt1 = integer.valueOf(ar2.get('tcnt1'));
                data.add(new PieWedgeData('Won Opps',cnt1));
           }
           
           for(AggregateResult ar3 : [Select Count(Amount)tcnt2 from Opportunity where FiscalYear =: year and FiscalQuarter =: quat and StageName = 'Closed Lost'])
           {
                Integer cnt2 = integer.valueOf(ar3.get('tcnt2'));
                data.add(new PieWedgeData('Lost Opps',cnt2));
           }
        }
       return data;
       
    }

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;
        }
    }

}

 


and following is my vf page,

 

<apex:page controller="picklistTest" showHeader="false" >
  <apex:form >
               <apex:pageBlock title="Select Range:">
                   <apex:actionRegion >  
                       <apex:selectList value="{!selectedVal}" size="1" multiselect="false">
                       <apex:selectOptions value="{!options1}"/>
                       <apex:actionSupport event="onchange" action="{!showValue}" rerender="profile,pipeline" />
                       </apex:selectList>
                   </apex:actionRegion>   
               </apex:pageBlock>

 

                <apex:chart data="{!pieData}" width="500" height="215">
                <apex:axis type="Category" position="left" fields="name" grid="false" gridFill="false"/>
                <apex:axis type="Numeric" position="bottom" fields="data" title="Count" minimum="0">
                <apex:chartLabel rotate="315"/>
                </apex:axis>
                <apex:barSeries orientation="horizontal" axis="bottom" xField="data" yField="name"/>
               </apex:chart>

</apex:form>
</apex:page>

 

Please help me to achieve the minimum code coverage. Its urgent.

 

Regards,

S.Sivakumar

 

 

 

 

 

Hi,

In forecast tab, one can see the details of quota, quota%attainment, Closed opportunities value. How to get those details in visulaforce page?

In which object those details gets stored?

 

Thanks,

S.Sivakumar

Hi,

 

This is my code,

 

<apex:page controller="picklistTest" showHeader="false" >
  <apex:form >
        <apex:pageBlock title="Sample">
           <apex:pageBlock title="Select the Quarter:">
           <apex:selectList value="{!selectedVal}" size="1">
           <apex:selectOptions value="{!options1}"/>
           </apex:selectList>
           </apex:pageBlock>

     </apex:pageBlock>
  </apex:form>
</apex:page>


I have some values in the picklist and once the user selects a value from the list i want to display that value (i.e) label in the same visualforce page in a seperate section.

Can anyone share some code to achieve this?

Please help me

 

Regards,

S.Sivakumar

 

Hi,

 

I am not able to access the Standard objects RevenueForecast and QuantityForecast via Data Loader and even if i query those objects in Query editor available in developer console, i am getting the error as "sObject type 'RevenueForecast' is not supported".


Is there any way to access the fields available in those two objects? And what is the difference between those objects?

 

Please help me.

 

Regards,

S.Sivakumar

Hi,

 

Can anyone share some code to display Quota and Quota % attainment in visualforce page? The details are available in forecasts tab in developer edition, but i dont know how get those details and display it in visualforce page..Please help me.

 

Regards,

S.Sivakumar.

To design a drop down list box (i.e) Picklist in visualforce is it necessary to create a custom object to store picklist values?

I am new to visualforce. Right now i am facing the following problem. Please help me.

 

I am designing a dashboard using visualforce. Can any one help me to include a drop down list box in visualforce, so that user can select a close quarter?

 

     eg : Close Quarter

            Q3 2012

    

 

If User selects a Quarter, then i have to display the day of the quarter in visualforce page in the following format.

 

   Q3 2012 Day 42 of 92

 

Please help me with some code to achieve this .its urgent

 

Regards,

S.Sivakumar

Hi,

 

I have enabled forecasts and enabled users in forecasts hierarchy. But i am not able to view quota related list in the personal information.

I am using developer edition ( Salesforce 13).

 

Is there any way to view quota related list in personal information?

 

Regards,

S.Sivakumar

Hi,

 

Is there any way to get attainment details of a sales person (i.e) booking and quota details of an organization in salesforce?

Please help me.

 

Regards,

S.Sivakumar

Hi,

 

In my developer account i have created the following user.

 

 User1 - Administrator

 User2 - Standard User (User license - Salesforce).

 

User1 has creted a custom object Test__c and enabled permission set (Availability - True, Access - Read) for User2, so that User2 can view the records in  Test__c.

 

For the standard object Opportunity User1 has created following trigger,

 

trigger employee_id on Opportunity (after insert, after update)
{
    List<AggregateResult> result = [SELECT OwnerId, Sum(Amount)tvalue FROM Opportunity GROUP BY OwnerId];
    List<Test__c> mylist = new List<Test__c>();
    Set<Test__c> myset = new Set<Test__c>();    
    for (Opportunity s : Trigger.new)
     {
        for(AggregateResult ar : result)
        {
            Test__c mytest = new Test__c();
            mytest.User__c = string.valueOf(ar.get('OwnerId'));
            integer v = integer.valueOf(ar.get('tvalue'));
            mytest.Sum_opp__c = v;
            if(myset.add(mytest))
            {
                mylist.add(mytest);
            }
        }
     }
     try
     {
        insert mylist;
     }
     catch (system.Dmlexception e)
     {
        system.debug (e);
     }
}

 

User1 has created Sharing setting for standard object Opportunity and custom object Test__c as private, so that User1 can view all the records and User2 can view only his records as grant access using hierarchies is enabled.

 

But my problem is, when i run the trigger from both the user account, User2 can view the results of User1 in Test__c(custom Object).

But actually User2 cant view the Opportunity records of User1 due to sharing settings(private).

Similarly User2 must not be allowed to view the results of User1 in Test__c.

 

Is there any way to prevent that issue?

 

Regards,

S.Sivakumar

 

Hi,

 

I am the administrator and i have created a New User with Profile as Standard User in my developer account in force.com,

So that New User can view and create new opportunities in the Opportunities table(Standard Object).

 

Is there any way to restrict him in creating new opportunities in Opportunities table(Standard Object) by adding permission set matching that profile?

 

And New user is also able to view the opportunities created by other users top in the hierarchy? Is there any way to restrict him to view only the Opportunities of Users lower than his hierarchy?

 

 

hi,

 

I have some input field in my visualforce page.

 

If i click a command button, the values entered must be cleared automatically.

 

I tried this using javascript but i am not able to achieve the end result.

 

Please help me.

 

Regards,

S.Sivakumar.

Hi,

 

Can anyone help me in writing test method for the following apex controller.

 

public with sharing class LookupPopupController
{
    public String query {get; set;}
    public List<Opportunity> opportunities {get; set;}
    public PageReference runQuery()
    {
        List<List<Opportunity>> searchResults = [FIND :query IN ALL FIELDS RETURNING Opportunity (id, name, StageName, Amount, CloseDate, FiscalQuarter, FiscalYear Where ForecastCategory IN ('Pipeline', 'Best Case') and CloseDate = THIS_FISCAL_QUARTER order by StageName)];
        Opportunities = searchResults[0];
        return null;
    }
}

 

Thank you,

S.Sivakumar

 

Hi,


I have a text in visualforce page. If the value is less than 100 then i have to change the font color to red and if it is greater than 100 then i have to change the font color to green.

 

I dont know how to achieve this.

 

Please explain me with some examples.

 

 

Thanks,

S.Sivakumar.

Hello,

 

Can someone help me with an idea in finding the average age of opportunities in each stage?

 

Thanks in advance

Hi,

i dont know how to start, in writing test method for the below controller. Can anyone help me?

 

This is my controller:

 

public with sharing class picklistTest
{
    Map<String, String> mapSelectListValues = new Map<String, String>();
    public String selectedVal {get;set;}
    public String selectedLab {get;set;}
    public List<SelectOption> getOptions1()
    {
        List<SelectOption> retVal = new List<SelectOption>();
        List<AggregateResult> result = [Select Id, type, Number, CALENDAR_YEAR(StartDate)s from Period];
        retVal.add(new SelectOption('','-- Choose a Group --'));        
        for(AggregateResult a : result)
        {
          String c  = String.valueOf(a.get('type'));
          integer v = integer.valueOf(a.get('Number'));
          integer s = integer.valueOf(a.get('s'));
          retVal.add(new SelectOption(a.Id,c+' '+v+' - '+s));                 
        }
        for(Selectoption s: retVal)
        {
            mapSelectListValues.put(s.getValue(), s.getLabel());
        }
        return retVal;    
    }

   public List<PieWedgeData> getPieData()
    {
        List<PieWedgeData> data = new List<PieWedgeData>();
        for(AggregateResult ar :[Select Fiscal_Year(StartDate)fy, Fiscal_Quarter(StartDate)fq from Period where Id =: selectedVal group by Fiscal_Year(StartDate),Fiscal_Quarter(StartDate)])
        {
           integer year = integer.valueOf(ar.get('fy'));
           integer quat = integer.valueOf(ar.get('fq'));
           for(AggregateResult ar1 : [Select Count(Amount)tcnt from Opportunity where FiscalYear =: year and FiscalQuarter =: quat])
           {
                Integer cnt = integer.valueOf(ar1.get('tcnt'));
                data.add(new PieWedgeData('Created Opps',cnt));
           }
           
           for(AggregateResult ar2 : [Select Count(Amount)tcnt1 from Opportunity where FiscalYear =: year and FiscalQuarter =: quat and StageName = 'Closed Won'])
           {
                Integer cnt1 = integer.valueOf(ar2.get('tcnt1'));
                data.add(new PieWedgeData('Won Opps',cnt1));
           }
           
           for(AggregateResult ar3 : [Select Count(Amount)tcnt2 from Opportunity where FiscalYear =: year and FiscalQuarter =: quat and StageName = 'Closed Lost'])
           {
                Integer cnt2 = integer.valueOf(ar3.get('tcnt2'));
                data.add(new PieWedgeData('Lost Opps',cnt2));
           }
        }
       return data;
       
    }

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;
        }
    }

}

 


and following is my vf page,

 

<apex:page controller="picklistTest" showHeader="false" >
  <apex:form >
               <apex:pageBlock title="Select Range:">
                   <apex:actionRegion >  
                       <apex:selectList value="{!selectedVal}" size="1" multiselect="false">
                       <apex:selectOptions value="{!options1}"/>
                       <apex:actionSupport event="onchange" action="{!showValue}" rerender="profile,pipeline" />
                       </apex:selectList>
                   </apex:actionRegion>   
               </apex:pageBlock>

 

                <apex:chart data="{!pieData}" width="500" height="215">
                <apex:axis type="Category" position="left" fields="name" grid="false" gridFill="false"/>
                <apex:axis type="Numeric" position="bottom" fields="data" title="Count" minimum="0">
                <apex:chartLabel rotate="315"/>
                </apex:axis>
                <apex:barSeries orientation="horizontal" axis="bottom" xField="data" yField="name"/>
               </apex:chart>

</apex:form>
</apex:page>

 

Please help me to achieve the minimum code coverage. Its urgent.

 

Regards,

S.Sivakumar

 

 

 

 

 

Hi,

 

This is my code,

 

<apex:page controller="picklistTest" showHeader="false" >
  <apex:form >
        <apex:pageBlock title="Sample">
           <apex:pageBlock title="Select the Quarter:">
           <apex:selectList value="{!selectedVal}" size="1">
           <apex:selectOptions value="{!options1}"/>
           </apex:selectList>
           </apex:pageBlock>

     </apex:pageBlock>
  </apex:form>
</apex:page>


I have some values in the picklist and once the user selects a value from the list i want to display that value (i.e) label in the same visualforce page in a seperate section.

Can anyone share some code to achieve this?

Please help me

 

Regards,

S.Sivakumar

 

Hi,

 

I need to pull stage duration API name. I can see this field in report. But why can't pull the API from opportunity? Why it is invisible? Please any solutions?

 

Thanks

Abhi

Hi,

 

I have a VF page which has a list of records. I would like to have a hyperlink on any one field to link to that record.

 

For eg. if the list has a list of opportunities and i would like to point the opportunity name to be hyperlinked to that opportunity record.

 

Thanks

Prady

 

 

 

  • October 19, 2011
  • Like
  • 0

I am having trouble finding a way to populate error messages to my visual force page. I would like to add a (custom) error message to a inputText on my visual force page like standard behaviour(red lines, and red error message). What I can accomplish is adding it to the top of the page, but how should I add it to one specific field(inputText or inputField)?

 

VF:code:

<apex:page>
<apex:form>
<apex:messages /> <!-- This is showing the errormessage at top -->
<apex:pageBlock mode="detail">
<apex:pageblockSection id="search" columns="1" rendered="{!editModus}">
<apex:outputLabel value="Value"></apex:outputLabel>
<apex:inputText value="{!aValue}"></apex:inputText> <-- HERE I WOULD LIKE TO have the error messages
<apex:commandButton value="Validate" action="{!validate}"/>
</apex:pageblockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

 And (a part) of my controller, now it adds the errormessage, but it is shown on top of the page

 

    public void validate() {
// other logic. I add a message to the page, but how can I add it to the input text
ApexPages.Message message = new ApexPages.message(ApexPages.severity.ERROR,'An error message.');
ApexPages.addMessage(message);
}

 

 

 

Another newbie question here.  I have created a page using the revenue forecast object that lists the forecast owner/start date/quota/closed

 

I'd like to add one more column after closed that shows the percentage of quota achieved.  There is no field on the Revenue Forecast object to pull this from, nor can  I add it as a custom field.  I'm pretty sure this can be calculated with a controller extention, but the few attempts I have made have not resulted in anything.

 

Controller:

 

 

public class retrieveQuota{
private List<Schema.RevenueForecast> revenueforecast;
public List<Schema.RevenueForecast> getRevenueForecast()

{
revenueforecast = [Select Closed,Pipeline,OpportunityRollupPipeline,OwnerId,Quota,StartDate
from RevenueForecast where StartDate>=2009-01-01 AND Quota<>NULL Order By OwnerId];

return revenueforecast;

}
}

 

 Page:

 

<apex:page controller="retrieveQuota" tabStyle="Opportunity">
<apex:pageBlock title="List">

<apex:pageBlockTable value="{!RevenueForecast}" var="f">
<apex:column value="{!f.OwnerId}"/>
<apex:column value="{!f.StartDate}"/>
<apex:column value="{!f.Quota}"/>
<apex:column value="{!f.Closed}"/>
</apex:pageBlockTable>


</apex:pageBlock>
</apex:page>

 

 Any help is most appreciated.  Thanks!