• srisom
  • NEWBIE
  • 75 Points
  • Member since 2009

  • Chatter
    Feed
  • 3
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 30
    Replies

Hi all,

 

Does anyone know if there is a way of bringing back sets of results in SOQL? For instance if I want to bring between the 20th and 50th rows back?

 

Thanks

 

James 

Please pardon this newbie question and provide the link if this has been answered before

 

I develop an Apex class X. I write another Apex class Y as a test class of X. When I migrate X to production, do I have to migrate Y too?

 

Thanks.

I am needing to change the value of a Phone formatted field when the contact name changes. In other words, when I select the contact name, thwe contact's phone number will be populated. How do I get started?

I'm aware of the governor's limitation that states that we can only process 100 records per element in the trigger. So if the trigger has , let's say, 4 records, then the max number of DML rows that can be processed is 400. In my case, I'm trying to update child records (contacts) when there is a change on a single parent record (account). The challenge is that we have a good number of accounts that have way over 100 contacts. So how should I approach this?

 

I've seen a few posts suggesting the usage of @future, but I'm not quite sure how to put it together. I wrote an s-control that will do this, but I'd like to start moving it so that it runs server side. Any ideas or suggestions will be greatly appreciated.

Message Edited by J&A-Dev on 09-10-2009 01:50 PM
  • September 10, 2009
  • Like
  • 0
I am trying to populate a list of custom child objects through a query.  The following code does not work

List<child__c> childlist; childlist=database.query('SELECT child__r.last_name__c, child__r.first_name__c FROM parent__c');

 

  • September 09, 2009
  • Like
  • 0

HI,

I want to get the information from $User.Department and assign it to a variable in the Apex class.

However, I don't know how to do this. Basically I want to get the user department object info and then

prefill the custom object field Department__c. Please help.

 

thanks

Paul

 

  • September 08, 2009
  • Like
  • 0

Hi,

Is there a way to center an inputField? The following code is left aligned by default. I want to position

the field in the center. Your help is appreciated.

 

<apex:inputField value="{!Time_Tracking__c.Description__c}" style="width: 300px" />

Thanks,

Paul

 

  • August 28, 2009
  • Like
  • 0

 

 

I basically want my user to be the owner of my test account

 

 

 

static testMethod void myUnitTest() { Profile p = [select id from profile where name='Standard User']; User u = new User(alias = 'standt', email='standarduser@testorg.com',isactive=true, emailencodingkey='UTF-8', lastname='Testing', Employee_T_Number__c='111111' , localesidkey='en_AU', profileid = p.Id ,USERROLEID='00E20000000HWRL' , LanguageLocaleKey='en_US',Cost_Centre__c='1236', timezonesidkey='Australia/Sydney', username='standarduser@testorg.com'); Account a=new Account(name='unitest',ownerid=u.id); insert a;

 

apparently the user id is blank . how can I get my user ID ?

 

  • August 28, 2009
  • Like
  • 0

Hi

 

I have a List of type ABC__c which have Account field API names.

 

By looping through the list i should get the fieldlabel and store it in Account list.

 

How can we achieve this? please help

 

 

Public List<ABC__c> lab=new List<ABC__c> ();
Public List<Account> Acctfieldnames=new List<Account> ();

for(Integer i=0;i<lab.size();i++)
        {
            SObject sname=lab.get(i);
            Schema.DescribeFieldResult G = Account.sname.getDescribe();
            Mstfieldnames.add(G);
         }

  • August 25, 2009
  • Like
  • 0

Hi,

  Im using  webservice to connect to .NET then im passing an array of records to the .net for that im planing to pass through the 2-dimensional array string, but im getting errors while declaring the 2-d array strings.

 

IS there any possibility to do this please guide me,

 

Thank you,

 Saran

 

  • August 25, 2009
  • Like
  • 0

Hi All, 

I am a newbie to salesforce. I would appreciate, if someone could help me with this. I have two visual force pages A and B. They both use common custom controller. VF page B should access the values set by VF page A. However, I do not want to pass values using apex:param, since I do not want the end user to see the values in query parameters. Is there any way I can access since both pages use the same custom controller?

 

VF Page A

------------

 

<apex:page controller="customcontroller">
<apex:commandButton action="{!gotoNextPage}" value="Next Page"/>
</apex:page>

 

VF Page B (/apex/pageB)

----------------------------

<apex:page controller="customcontroller">
Test Value :{!testValue}
</apex:page>

 

customcontroller

-------------------

 

public String testValue { get; set; }

public PageReference gotoNextPage() {
testValue='TestValue set in VF page A';
// set the next page to VF page B
PageReference page = new PageReference('/apex/pageB');
return page;
}


Hence, when I navigate to pageB, I would like to see Test Value:TestValue set in VF page A. Again, I don't want the URL to be /apex/pageB?testValue='TestValue set in VF page A'. Is it possible to do using VF or apex? I might be missing something simple as well. Thanks for your time to help me.

 

 

http://www.edlconsulting.com

 

 

 

 

 

Message Edited by prakashedl on 11-13-2009 02:32 PM

hi,

 

I have created a simple command button on a VF page which goes to an apex class method.

It simply looks like this: <apex:commandButton action="{!opcancel}" value="Cancel Opp/Order" />

The !opcancel functionality is handled in an apex class as follows:

public class OppOperations {
    public OppOperations(ApexPages.StandardController controller) {

    }

    public PageReference opcancel() {
      
      opportunity[] updates = new opportunity[1];
      opportunity update_opportunity = new opportunity();
      
      update_opportunity.Id= '006R0000004aSPW'; //PROBLEM 1: why wont this line compile ?
            update_opportunity.Opp_Order_Status__c = 'Cancelled Order';
      
      updates[0] = update_opportunity;
      
      binding.update(updates); // PROBLEM 2: why wont this line compile
      
      PROBLEM 3: here I want to close the VF window that called this class as the update
                 is now complete
      return null;
    }

}

Basically - I have 3 problems in the above code snippet. I want to update my opportunity status to be

'Cancelled'. I would like to use SOQL to do this based on the unique record id. Question how can I do this?

Why is my syntax wrong? I can't find code examples of this type. Also - how can I close the VF window that

called this function? I want the original window to refresh showing the updated status. Basically - I need to

use SOQL to perform customised updates on individual object records. Any help would be much appreciated.

TIA.

Hi,

    I have a visualforce page, in which two fields are present. One is 'Account Name' which is a look up on Account object, other field is a textbox named as Account number.

Is it possible on select of a particular account, automatically Account number also get populated to the input TextText.

 

Thanks,

Raj

Please pardon this newbie question and provide the link if this has been answered before

 

I develop an Apex class X. I write another Apex class Y as a test class of X. When I migrate X to production, do I have to migrate Y too?

 

Thanks.

I am going through some examples in the Developer guide and can't get passed an error.  The code is a trigger that adds a record in another table based on the value of a field that has been changed.  I really don't see how I am exceeding the trigger depth when I am simply inserting a record into a seperate table. 

 

Also, the exceptions are not being caught.  The error message I receive does not come from my code.

 

Any help would be appreciated!

 

 

 

Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger assignInterviewers caused an unexpected exception, contact your administrator: assignInterviewers: maximum trigger depth exceeded Job_Application trigger event AfterUpdate for a02A00000018Q5D Job_Application trigger event

 

trigger assignInterviewers on Job_Application__c (after insert, after update) {

   List<Review__c> addReviews = new List<Review__c>();

    for (Job_Application__c JA : trigger.new){

      List<User> selectedReviewers = [select ID from user limit 1];

        if (JA.status__c == 'New') {

         ID jobID = JA.ID;

         For ( User u : selectedReviewers) {            addReviews.add(new Review__c( Job_Application__c = jobID, reviewer__c = u.ID, rating__c = 3));

         }

           try {

              insert addReviews;

         }

           catch (DmlException de) {               for (Integer i = 0; I < de.getNumDml(); i++) {

              JA.addError('dmlexption' + de.getDmlMessage(i));

           }

       }

         finally {          JA.addError('made it to finally');

       }

    }

  }

}

I am needing to change the value of a Phone formatted field when the contact name changes. In other words, when I select the contact name, thwe contact's phone number will be populated. How do I get started?

I am working on a visualforce page so that users can create certain opportunities (it's similar to a wizard, but it is only 1 page).  For some users, the Account Name field is read-only.  The administrators say that those people have the correct permissions, so is there anything that I can check or implement in order for the field to appear as an inputfield for them?  Thanks.

 

 

Difference between refresh and deploy ?

 

Thanks

  • August 13, 2009
  • Like
  • 0

Hi 

I have a situation in which a @future method called by 2 trigger is called recursively and I get a ' @future cannot be called from a @future method'

 

Is there a way to avoid this. I learnt that static variables can be used but I dont know how to use it correctly  

 

Thanks

 

  • August 12, 2009
  • Like
  • 0

We're currently getting a System.ListException: Duplicate id in list error in one of our triggers, but can't figure out why.

 

Any ideas?


Thanks,
Brad

 

Here is our code:

 

trigger TrackingNumberTrigger on Tracking_Number__c (after insert, after update) {

List<Case> casesToUpdate = new List<Case>();
Set<Id> orderNumbers = new Set<Id>();

for(Tracking_Number__c trackingNum : trigger.new) {
if(trackingNum.Order__c!=null) {
if(!orderNumbers.contains(trackingNum.Order__c)) {
orderNumbers.add(trackingNum.Order__c);
}
}
}

List<Case> caseList = new List<Case>([Select Id, Order_Number__c, Related_To_Order__c From Case Where Related_To_Order__c IN :orderNumbers LIMIT 1000]);

for(Tracking_Number__c trackingNum : trigger.new) {
for(Case a : caseList) {
if(a.Order_Number__c==null && a.Order_Number__c==trackingNum.Name) {
a.Related_To_Order__c = trackingNum.Name;
}
// currently assume 1 to 1 mapping
if(trackingNum!=null && trackingNum.Order__c==a.Related_To_Order__c) {
a.Tracking_Number__c = trackingNum.Name;
a.Shipper__c = trackingNum.Shipper__c;
a.Tracking_URL__c = trackingNum.Tracking_Url__c;
}
casesToUpdate.add(a);
}
}
update casesToUpdate;
}

 

 

 

Hi, I have a couple of questions around labels.

 

1)Is there any way I can leverage a standard error message from app (Error: Invalid Data. Review all error messages below to correct your data.) in my visual force page?   I checked $Label.site merge field, but don't see this error listed there.

2) If the answer to the above question is no, I guess my next option would be to use "error" label (Error: {0}) from $Label.site merge field. But can someone tell me how I can pass the {0} parameter to this label.

 

I am aware that I can create my own custom label to do this. But I am trying to leverage the standard functionality as much as I can for obvious reasons and hence these questions.

 

Thanks!