• Vivek Viswanath
  • NEWBIE
  • 0 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 14
    Questions
  • 27
    Replies
I am calling this function that returns a list from a map  I want to sort this list the query itself has an orderby but its lost when we do the .values() I checked and the query works fine.



 return getOriginalOrderItems( programOrderIds ).values();

Suppose I want to sort on HS_Level_Display__c

can do something like this.

list<HS_Order_Items__c> items = new list<HS_Order_Items__c>();

items  = getOriginalOrderItems( programOrderIds ).values();

items.sort(HS_Level_Display__c);




Message Edited by Vivek Viswanath on 09-08-2008 07:44 AM
Hi,

I am getting an error on page while deploying the controller. I have test calsses and all except one controller has above 90% and the one has about 80% yet when I try to deploy it I get an error saying Error on page.

The only thing is that my visual force pages are outside the package and the controller is inside it.

Any ideas on this.

Regards

Vivek Viswanathan


Message Edited by Vivek Viswanath on 08-28-2008 09:05 AM
Hi,

Just curious if I can change the salesforce Login screen look and feel & or allow external users to view my page on salesforce ie a person need not login to salesforce to view my page. I was curious if this is even possible..  Any Ideas on this one????


Regards

Vivek Viswanathan


Message Edited by Vivek Viswanath on 08-22-2008 11:43 AM

Message Edited by Vivek Viswanath on 08-22-2008 11:46 AM

Message Edited by Vivek Viswanath on 08-22-2008 11:50 AM

Message Edited by Vivek Viswanath on 08-22-2008 12:25 PM

Message Edited by Vivek Viswanath on 08-22-2008 12:27 PM
Hi,

I think I have a similar Issue

trigger Account_Set_Owner_OnLoad_Temp on Account (before update)
{
   
    for ( Account acct : Trigger.new )
    {
        acctIds.add(acct.Id);
    }
   
    List<Contact> contactList = new List<Contact>([Select Id From Contact where AccountId in :acctIds]);
   
if(!contactList.isempty())
{
     update contactList;
 }

}

This is  a simple code and just updates contacts for the account as I have an on update trigger on contact that just gets the account owner and sets it to the contact owner. However I run into an issue with account more than say 50 contacts at times even less than that. I read through the posts and saw that Spring 08 has a fix for this however I need an alternative now. I am not talking of 2000 but around 200 contacts here.

Regards

Vivek


Message Edited by Vivek Viswanath on 08-14-2008 10:38 AM
The following code works for Firefox and shows the total however it fails for IE . I am trying to execute the Action support on the Change event of the Apex table. I tried moving the action support to inside the column tag however it then works only for the first row but dose not work for Firefox. Please let me know if there is anything I am doing wrong here. The code here works for Firefox.

<apex:page id="Test_Action_Support" controller="Test_Action_Support_Controller" action="{!init}" rendered="true" >

<apex:outputPanel >
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockTable width="550" value="{!accts}" var="itemsToOrder">
            <apex:actionSupport event="onchange" action="{!calTotalHistoricalRevenue}"rerender="tableTotal" />
                <apex:column headerValue="Item Listed">
                    <apex:inputfield value="{!itemsToOrder.HS_Total_Available_Heart_Smart_Points__c}"/>
                    <apex:facet name="footer">
                    Total Cost of Reg Kit Items:
                    </apex:facet>
                </apex:column>
                <apex:column headerValue="Quantity">
                 
                        <apex:facet name="footer">
                        <apex:outputPanel id="tableTotal">
                        <apex:outputText value="{!totalHistoricalRevenue}"></apex:outputText>
                        </apex:outputPanel>
                    </apex:facet>
                </apex:column>

       
            </apex:pageBlockTable>

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

public class Test_Action_Support_Controller
{

public List <Account> accts= new List <Account>();
public Double totalHistoricalRevenue = 0;
    
    public List <Account> getaccts()
    {
        return accts;
    }
    public Double gettotalHistoricalRevenue()
    {
        return totalHistoricalRevenue;
    }
    // init function that gets the accounts
    public void init()
    {
        accts = [select HS_Total_Available_Heart_Smart_Points__c from Account limit 10];
    }
    
    // THis is the function to calculate the total to be called by the action support
    public PageReference calTotalHistoricalRevenue()
    {
        for (account acct : accts)
        {
            if(acct.HS_Total_Available_Heart_Smart_Points__c!=null)
            {
                totalHistoricalRevenue = totalHistoricalRevenue + acct.HS_Total_Available_Heart_Smart_Points__c;
            }
        }      
        return null;
    }

}
Hi,

Just a curious question has anyone tried creating a login page that can replace or sit on top of  the salesforce login page? which can be exposed for internal users to login from.

Would like to know if this is even possible.

Regards

Vivek
  HI

I was trying to call a custom javascript function on click which inturn calls the action function I would like to know if I am doing it right. its not going into my controller function.
This is what I want to do
 
function save_clicked() // custom function
{
// logic(this part works)
  saveOrder();// call to the action function
}         

<apex:actionFunction name="saveOrder" action="{!SaveProgramOrderAndItems}" />
       <apex:pageBlockButtons location="bottom">
          
  <apex:commandButton value="Save and Create Order" onclick="save_clicked"/>
    I have multiple page block section under the same Output panel however only the last one actually refreshes.
 <apex:outputpanel id="orderDisplay">
            <apex:pageBlockSection id="reorderReason0" title="Reason for Re-Order" >
            </apex:pageBlockSection>
           
            <apex:pageBlockSection id="reorderItemSelection1" title="Confirm Order Items" >
             </apex:pageBlockSection>
           
            <apex:pageBlockSection id="reorderItemSelection2" title="Confirm Orders Items" >
            </apex:pageBlockSection>
            </apex:outputpanel>
Hi

I was trying to pass data between pages using the controller which failed. Is this possible every time I redirect I loose the state of the controller.

I have two pages with the same controller can I keep the data in the controller when I move from one page to the other sharing the data betweent he pages.

Regards

Vivek


Message Edited by Vivek Viswanath on 07-22-2008 10:50 AM

Message Edited by Vivek Viswanath on 07-22-2008 10:51 AM
Hi I have a controller function that I call on page load and i also Have a condition specified which if satisfied it returns another PageReference however it dosent show the page. when I use the command with a command button it works.

public PageReference SFDCRegKitController() // This is my function
        {
              
               setOpportunityId();
                setCampaignId();
                getData.poplulateRegistritationKitItemsList(campaignId);
                getData.populateOpportunity(this.opportunityId);
               
                if( getData.changeToReOrderScreen == true)
                {
                    return Page.reg_re_order;//registrationKitReOrder(); // this is the page I want to go to.
                }
                return null;
                //getData.populateOrderItemList();
                
        }

This is my page I put in debug statements and it goes into that part of the code and also returns the page. However its not displayed. Please let me know what I am doing wrong here

<apex:page controller="SFDCRegKitController" action="{!SFDCRegKitController}" >
</apex:page>


Message Edited by Vivek Viswanath on 07-22-2008 06:15 AM
How can I deploy profile change using Force.com

Regards

Vivek



Hi,

Can I use the force.com plugin to transfer profile changes?

Regards

Vivek

Hi All,

This is the scenario we are working with and are having an issue looking for a solution.

I am trying to retrieve more than 1000 records in an Apex Query and apparently 1000 is the upper limit to the number of records that can be retrieved.

Dose any one know of a query more in a trigger or how to implement this. 

Below is the query:

for (Lease_Com__c[] leaseCommission :

[select Id, lease_nbr__r.Name, gcp_amt__c, lease_nbr__r.End_User__c, lease_nbr__r.Funded_Dt__c from lease_com__c

where OwnerId = :UserID

and lease_nbr__r.Funded_Dt__c < :dtBeginningOfNextMonth

and lease_nbr__r.Funded_Dt__c >= :dtBeginningOf6MonthsPrevious

order by lease_nbr__r.Funded_Dt__c desc] ) {

}


Vivek Viswanathan


Hi All,

 

This is the scenario we are working with and are having an issue looking for a solution.

I am trying to retrieve more than 1000 records in an Apex Query and apparently 1000 is the upper limit to the number of records that can be retrieved.

Dose any one know of a query more in a trigger or how to implement this. 

Below is the query:

for (Lease_Com__c[] leaseCommission :

[select Id, lease_nbr__r.Name, gcp_amt__c, lease_nbr__r.End_User__c, lease_nbr__r.Funded_Dt__c from lease_com__c

where OwnerId = :UserID

and lease_nbr__r.Funded_Dt__c < :dtBeginningOfNextMonth

and lease_nbr__r.Funded_Dt__c >= :dtBeginningOf6MonthsPrevious

order by lease_nbr__r.Funded_Dt__c desc] ) {

}


Vivek Viswanathan


Hi,
 
I am new to Apex. Can anyone help me on this. I want to check whether a field is null or not using Apex classes.
 
For ex: There is a number field Ratio in custom object Program. Before doing calculations using ratio I just want to check whether ratio is empty.
 
Below is the code. It's not showing any error,but line numbers 4 and 7 are not covered.
 
1. Program__c[] pc = [SELECT id,Program_Net_to_Gross_Ratio__c,Labor_Multiplier__c,Labor_Rates__c from Program__c];
2. if(pc.size() > 0)
3. {
4. if(pc[0].Program_Net_to_Gross_Ratio__c != null)
5. pratio = pc[0].Program_Net_to_Gross_Ratio__c;
6. else
7. pratio = 0;
8. }
  • September 12, 2008
  • Like
  • 0
Hi...
 
       I want to pass inputtext field value to controller.
 
In controller based on this value I have to do some calculation..
 
I know settermethod is used for it..  I couldnt understand the example which u gave in user guide..
 
Any one send some sample code for
   ------how to pass input text value to controller 
   ------In controller how to recieve this value.. Based on this value I have to do some calculation 
   ------the result is displayed in another inputtext in UI.....
How to achive it.
 
 
 
 
I'm new to Visualforce and I've been trying for over 2 weeks to figure this out and I know it has to be something simple.  Any help is appreciated!
 
I want to add a custom controller to a page.  Yet every time I try to create it I get the error message
Error: Apex class 'GoldSheet' does not exist
  I've read in many of the tutorials, etc that you should have a link to create the controller as well as read that the controller link should appear next to Page Editor.  But so far I've got nothing.  I've created many "test" pages using the samples from the book and I continue to get nowhere. 
 
I attempted to try and add an Apex Class under Setup>Develop but I don't have a New button.   Do I need special permissions or am I missing something completely?
 
Thanks!
Hi,

I think I have a similar Issue

trigger Account_Set_Owner_OnLoad_Temp on Account (before update)
{
   
    for ( Account acct : Trigger.new )
    {
        acctIds.add(acct.Id);
    }
   
    List<Contact> contactList = new List<Contact>([Select Id From Contact where AccountId in :acctIds]);
   
if(!contactList.isempty())
{
     update contactList;
 }

}

This is  a simple code and just updates contacts for the account as I have an on update trigger on contact that just gets the account owner and sets it to the contact owner. However I run into an issue with account more than say 50 contacts at times even less than that. I read through the posts and saw that Spring 08 has a fix for this however I need an alternative now. I am not talking of 2000 but around 200 contacts here.

Regards

Vivek


Message Edited by Vivek Viswanath on 08-14-2008 10:38 AM

I need an APEX trigger that would copy comments from a Case to the Activity history of a Person Account.  Any existing code for this?

Thanks,

JRB

Hi,

I am using a command button on click of which an outputpanel gets rerendered. But i want user to confirm this before the panel gets refreshed.


Code: JS
function confirm()
{
 return window.confirm('Are you sure?');
}


Code: VF Button
<apex:commandButton id="clearS" rerender="detail"  onclick="return confirm();"  value="Clear" />

The problem is that is user selects yes, the complete page gets refreshed. But if i remove this confirm function, it only refreshes the ouputpanel itself.

Is there any way i can use confirm before rerendering a layer. Please advise.

GM

  • August 05, 2008
  • Like
  • 0
The following code works for Firefox and shows the total however it fails for IE . I am trying to execute the Action support on the Change event of the Apex table. I tried moving the action support to inside the column tag however it then works only for the first row but dose not work for Firefox. Please let me know if there is anything I am doing wrong here. The code here works for Firefox.

<apex:page id="Test_Action_Support" controller="Test_Action_Support_Controller" action="{!init}" rendered="true" >

<apex:outputPanel >
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockTable width="550" value="{!accts}" var="itemsToOrder">
            <apex:actionSupport event="onchange" action="{!calTotalHistoricalRevenue}"rerender="tableTotal" />
                <apex:column headerValue="Item Listed">
                    <apex:inputfield value="{!itemsToOrder.HS_Total_Available_Heart_Smart_Points__c}"/>
                    <apex:facet name="footer">
                    Total Cost of Reg Kit Items:
                    </apex:facet>
                </apex:column>
                <apex:column headerValue="Quantity">
                 
                        <apex:facet name="footer">
                        <apex:outputPanel id="tableTotal">
                        <apex:outputText value="{!totalHistoricalRevenue}"></apex:outputText>
                        </apex:outputPanel>
                    </apex:facet>
                </apex:column>

       
            </apex:pageBlockTable>

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

public class Test_Action_Support_Controller
{

public List <Account> accts= new List <Account>();
public Double totalHistoricalRevenue = 0;
    
    public List <Account> getaccts()
    {
        return accts;
    }
    public Double gettotalHistoricalRevenue()
    {
        return totalHistoricalRevenue;
    }
    // init function that gets the accounts
    public void init()
    {
        accts = [select HS_Total_Available_Heart_Smart_Points__c from Account limit 10];
    }
    
    // THis is the function to calculate the total to be called by the action support
    public PageReference calTotalHistoricalRevenue()
    {
        for (account acct : accts)
        {
            if(acct.HS_Total_Available_Heart_Smart_Points__c!=null)
            {
                totalHistoricalRevenue = totalHistoricalRevenue + acct.HS_Total_Available_Heart_Smart_Points__c;
            }
        }      
        return null;
    }

}
Hi,
 
I have a VF page that has a "Delete" commandButton on it. The button action calls a method called "deleteSettings" in my controller to delete an object from Salesforce. The page looks something like this:
 
Code:
<apex:page controller="MyController" >
    <apex:messages />
    <apex:form id="settingsForm" >
    
        <apex:sectionHeader title="API Connection" rendered="{!settingsDefined}" >
        
            <apex:pageBlock title="Settings" mode="detail" rendered="{!NOT(editMode)}">
                <apex:pageBlockSection columns="1">
                    <apex:outputField id="endpoint" value="{!ppConnection.API_Endpoint__c}" />
                    <apex:outputField id="user" value="{!ppConnection.User__c}" />
                    <apex:outputField id="password" value="{!ppConnection.Password__c}" />
                    <apex:outputField id="signature" value="{!ppConnection.Signature__c}" />
                    <apex:outputField id="version" value="{!ppConnection.Version__c}" />
                </apex:pageBlockSection>
                <br/><br/>
                <apex:commandButton value="Edit" action="{!edit}" />
                <apex:commandButton value="Delete" action="{!deleteSettings}" immediate="true" />
            </apex:pageBlock>
            
        </apex:sectionHeader>                            
            
    </apex:form>    
</apex:page>

 
This works fine, as expected. The deleteSettings action is called when the button is clicked. So, now I wanted to implement a confirmation dialog, so the deleteSettings action method is only called once the user clicks OK. I modified the page as follows (changes highlighted in red):
 
Code:
<apex:page controller="MyController" >
    <apex:messages />
    <apex:form id="settingsForm" >
    
        <apex:actionFunction name="deleteSettings" action="{!deleteSettings}" reRender="settingsForm" />
    
        <apex:sectionHeader title="API Connection" rendered="{!settingsDefined}" >
        
            <!-- This pageBlock is if we are NOT in "edit" mode -->
            <apex:pageBlock title="Settings" mode="detail" rendered="{!NOT(editMode)}">
                <apex:pageBlockSection columns="1">
                    <apex:outputField id="endpoint" value="{!ppConnection.API_Endpoint__c}" />
                    <apex:outputField id="user" value="{!ppConnection.User__c}" />
                    <apex:outputField id="password" value="{!ppConnection.Password__c}" />
                    <apex:outputField id="signature" value="{!ppConnection.Signature__c}" />
                    <apex:outputField id="version" value="{!ppConnection.Version__c}" />
                </apex:pageBlockSection>
                <br/><br/>
                <apex:commandButton value="Edit" action="{!edit}" />
                <apex:commandButton value="Delete" onclick="confirmDelete();" />
            </apex:pageBlock>
            
        </apex:sectionHeader>                            
            
    </apex:form>    
    

    <script>
        function confirmDelete() {
            if (confirm("Are you sure you want to delete the API settings—")) {
                // Invoke the apex:actionFunction that performs the delete
                
                alert("Calling deleteSettings");
                deleteSettings();
            }
        }
    </script>
</apex:page>

When I do this, it does not appear that my "deleteSettings" actionFunction is calling the "deleteSettings" method in my controller. I do observe that the "Calling deleteSettings" alert is displayed, however, the object is not being deleted. I know the "deleteSettings" method in the controller is working, because it worked correctly when I invoked it directly as the action of the commandButton. I'm not sure why it is not being called from the actionFunction. Any ideas? TIA.
  • August 04, 2008
  • Like
  • 0
I'm not sure if this is an easy or hard thing to do (my previous work makes me think it's not easy).
 
I'd like 2 VF pages (VF1 and VF2) - and on VF1 there's a 'Go' button which calls VF2 which does some work (e.g. writes "1" to the screen), then goes back to VF1, which calls VF2 again, which writes "2", and so on, until VF2 gets to 10, and then goes on to do something else.
 
Thanks.
Hi

I was trying to pass data between pages using the controller which failed. Is this possible every time I redirect I loose the state of the controller.

I have two pages with the same controller can I keep the data in the controller when I move from one page to the other sharing the data betweent he pages.

Regards

Vivek


Message Edited by Vivek Viswanath on 07-22-2008 10:50 AM

Message Edited by Vivek Viswanath on 07-22-2008 10:51 AM

Hi All,

 

This is the scenario we are working with and are having an issue looking for a solution.

I am trying to retrieve more than 1000 records in an Apex Query and apparently 1000 is the upper limit to the number of records that can be retrieved.

Dose any one know of a query more in a trigger or how to implement this. 

Below is the query:

for (Lease_Com__c[] leaseCommission :

[select Id, lease_nbr__r.Name, gcp_amt__c, lease_nbr__r.End_User__c, lease_nbr__r.Funded_Dt__c from lease_com__c

where OwnerId = :UserID

and lease_nbr__r.Funded_Dt__c < :dtBeginningOfNextMonth

and lease_nbr__r.Funded_Dt__c >= :dtBeginningOf6MonthsPrevious

order by lease_nbr__r.Funded_Dt__c desc] ) {

}


Vivek Viswanathan


I have a simple trigger that creates a tracking record every time the owning group changes (we call this escalation group).  The purpose is to have time tracking similar to how salesforces give you time in status for  service and support cases.  However, the trigger fails with an exception if there are more than 20 records in the new_entries set.   I can work around this, but my solutions  are  seriously kludgy.  Is there a better approach I'm missing?

-Tyler

Here is the code:

trigger recordStatusDates on Case (after update) {

  List<Case_Status_Log__c> new_entries = new List<Case_Status_Log__c>();

  for( integer i = 0; i < Trigger.new.size(); ++i) {

    if (Trigger.old[i].status != Trigger.new[i].status) {
      new_entries.add(Util.buildCaseStatusLog('Status', Trigger.new[i].id, Trigger.old[i].status, Trigger.old[i].status_changed__c, Trigger.new[i].status_changed__c));
    }
    if (Trigger.old[i].escalation_group__c != Trigger.new[i].escalation_group__c) {
      new_entries.add(Util.buildCaseStatusLog('Escalation_group',
          Trigger.new[i].id, Trigger.old[i].escalation_group__c,
          Trigger.old[i].escalation_group_changed__c, Trigger.new[i].escalation_group_changed__c));
    }
  }
  insert new_entries;
}

//Copied from Util
public static Case_Status_Log__c buildCaseStatusLog(String typeOf, Id id, String value, Datetime oldDate, Datetime newDate) {
      Case_Status_Log__c csl = new Case_Status_Log__c();
      csl.case__c = id;
      csl.value__c = value;
      csl.value_type__c = typeOf;
      csl.start_datetime__c = oldDate;
      csl.stop_datetime__c = newDate;
     
      if(oldDate != null && newDate != null) {
        csl.hours_in_state__c = util.hoursBetween(
                                   csl.start_datetime__c,
                                   csl.stop_datetime__c);
      }
      return csl;
  }