• Boman
  • NEWBIE
  • 25 Points
  • Member since 2010

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 12
    Questions
  • 23
    Replies

Anyone else seeing this?

 

Occurs on "Edit" of Account that has the Edit button overridden to bring up an AccountEditVFPage.

 

Debug logs shows no error!

 

Ideas?

  • February 09, 2011
  • Like
  • 0

Here's my situation: I've got approx. 200K Accounts/Customers in my SFDC instance, and now need to calculate and assign a LCV (Lifetime Customer Value) to each of these. I've got the individual metrics and the LCV function defined. The plan is apply computeLCV() "one-time" to every existing customer in order that I have this value for all Accounts. Then, on an on-going basis I would use a "after update" trigger to re-calc LCV if any of the metric-bearing field change. Straightforward!

 

But, I'm not sure what's the correct approach to the handle the "one-time 200K Account" calculateLCV processing!! Should I:

 

1> Use scheduled Apex:

global class calculateLCV implements Schedulable { 
 global void execute(SchedulableContext ctx) {
 // Query/retrieve and calculate LCV for all 200K existing Account}

I could then schedule this job to run just once! After a successful run, delete it!

 

2> Use the Bulk API to extract and process the 200K Accounts

 

3> Some other alternative e.g. regular Apex, invoked via a button click to do the same thing (and later removed), or Anonymously execute some Apex code to achieve the desired calculation, etc.

 

Thanks for your suggestions!

  • February 02, 2011
  • Like
  • 0

This what the external WS sends out as a response:

 

<?xml version="1.0" encoding="UTF-8" standalone="no" ?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns="http://www.xyzsite.com/XsdFromWsdl" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><tns1:ReleaseTicketResponse xmlns:tns1="http://tempuri.org/"><tns1:ReleaseTicketResult xmlns:ns="http://www.w3.org/2001/XMLSchema" xsi:type="ns:boolean">1</tns1:ReleaseTicketResult>

 

But, in SFDC, the response I receive (instead of being a TRUE, since 1 = TRUE) shows ReleaseTicketResult as FALSE. Any suggestions? Thanks.

 

WebService.ReleaseTicketResponse_element:[ReleaseTicketResult=false, ReleaseTicketResult_type_info=(ReleaseTicketResult, http://www.w3.org/2001/XMLSchema, boolean, 1, 1, false), apex_schema_type_info=(http://tempuri.org/, true, false), field_order_type_info=(ReleaseTicketResult)
  • January 13, 2011
  • Like
  • 0

My production instance exceeded my data storage limits, but since I never received any notifications this went unnoticed until I refreshed my FULL sandbox. This full sandbox was unusable because I kept getting the "Data Storage Limit Exceeded" exception.

 

I've since deleted objects from Production to bring the total storage in compliance with limits, but I CANNOT refresh my sandbox for another 29 days! Thus, my full sandbox sits useless, cause it still reflects a data storage limit exceeded state.

 

What's the resolution? Wait patiently for 29 days before I can get to use my full sandbox again? Thanks.

 

--Boman.

  • May 26, 2010
  • Like
  • 0

I'm opening a new window using JS sitting  behind a custom button on Account using:

 

window.open(woURL,"_blank","toolbar=no, titlebar=yes location=yes, directories=no, status=no, scrollbars=yes, menubar=no, copyhistory=yes, resizable=yes, width=1000, height=375");

The woURL points to a VF page, for which I have:

 

<

apex:page title="MyTitle" controller="WOController" showHeader="false" standardStylesheets="true" tabStyle="Account">

 

No matter what I've tried so far - various options in the JS code and on the VF page, but I just cannot get the Title to show up in IE.

 

Suggestions? Thanks.

 

--Boman.

  • May 25, 2010
  • Like
  • 0

Is there any way to include my organizations "custom" training/tutorial under the standard link? More specifically, I'd like my users to be presented training/tutorial options when they log in, taking into consideration their Role/Profile. I'd also like to maintain the training history for each each user (like the default SFDC does) and let users learn at their on pace, maintaining the state of completion of each tutorial they access. Thanks.

 

--Boman.

  • April 22, 2010
  • Like
  • 0
I've got code (written by a consultant) that has approx. 15K lines split across about 20 .page files. The first 40 or so lines of each page is basically identical (info about the Account, etc.) This is bloated code! Is there a way I can make things more readable by simple having one .page which is then "imported" or "included" by the other 20? Thanks.
  • March 18, 2010
  • Like
  • 0

We're building new functionality in developer sandboxes that have no data. Since we do not require a subset of objects from our Production instance while developing in the sandbox, we were hoping to pull data back and forth between Production<-->Sandbox, as required.

 

Is this possible? How? Thanks.

 

--Boman. 

  • March 11, 2010
  • Like
  • 0

I have Site__c and Property__c objects, each having a lookup to the other. I'm importing data into SF using a Java app written against the Bulk API. Now, I first insert Site__c objects into SF, collect their IDs, and now want to specify the relationship to a Site__c when I insert a Property__c.

 

I've been trying this in my CSV for Property objects, but it fails:

 

Site__r.ID

a07Q0000000YkNAIA0    <=== ID of Site__c object that has already been populated into SF.

 

The error I get says:

 

Failed with error: INVALID_FIELD:Field name provided, Id is not an External ID or indexed field for Site__c:--

 

Note: each of Property and Site have a "LookUp" relationship with each other.

 

Any suggestions?

  • February 26, 2010
  • Like
  • 0

For use with the Bulk API? Cannot see it at:

 

http://code.google.com/p/sfdc-wsc/

 

Related question: are NULL values in fields that previously contained non-NULL values, but were marked nillable supported via the Bulk API? Thanks.

  • February 24, 2010
  • Like
  • 0

For use with the Bulk API? Cannot see it at:

 

http://code.google.com/p/sfdc-wsc/

 

Related question: are NULL values in fields that previously contained non-NULL values, but were marked nillable supported via the Bulk API? Thanks.

  • February 24, 2010
  • Like
  • 0

I've inherited a large Apex project, 10s of KLOC. I don't think any UML diagrams for this exist. For my own clear understanding of what's happening in this code I am looking for an Eclipse plugin (preferably FREE) that supports generating UML from my Apex code. Any suggestions? Have you tried any of the similar plugins for Java RE? Were they accurate? Thanks.

 

--Boman.

  • February 18, 2010
  • Like
  • 0

I am in the process of developing a controller in which I have to use global variables. While doing so I am receiving the below error. 

 

                My code :             

 

 public class PurchasedProducts {
    List<Contact> c; 
   
      
   public List<Contact> getPurchasedProducts() {
       if(c == null) c = [select id, name from contact WHERE FirstName =:User.FirstName];
       return c;
   }
   }

 

                Error      :   Invalid bind expression type of Schema.SObjectField for column of type String

 

I am trying to get the Account details of a logged in portal user using an apex class.

 

I might be wrongly referring the global variable ..Any help on this one is highly appreciated.

 

Thank you,

Sampath

We are receiving an error while deploying to production:
MyProfilePageController.testSave System.QueryException: List has no rows for assignment to SObject
Class.MyProfilePageController.testSave: line 78, column 35

MyProfilePageController class is automatically generated, I mean we didn't write code for this.

 

 

/**
 * An apex class that keeps updates of a portal user in sync with its corresponding contact.
   Guest users are never able to access this page.
 */
public class MyProfilePageController {

    private User user;
    private boolean isEdit = false;
    
    public User getUser() {
        return user;
    }

    public MyProfilePageController() {
        user = [SELECT id, email, username, usertype, communitynickname, timezonesidkey, languagelocalekey, firstname, lastname, phone, title,
                street, city, country, postalcode, state, localesidkey, mobilephone, extension, fax, contact.email
                FROM User
                WHERE id = :UserInfo.getUserId()];
        // guest users should never be able to access this page
        if (user.usertype == 'GUEST') {
            throw new NoAccessException();
        }
    }
    
    public Boolean getIsEdit() {
        return isEdit;
    }
    
    public void edit() {
        isEdit=true;
    }    
    
    public void save() {
        if (user.contact != null) {              
            setContactFields(user.contact);
        }
        
        try {
            update user;
            if (user.contact != null) { 
                update user.contact;
            }
            isEdit=false;
        } catch(DmlException e) {
            ApexPages.addMessages(e);
        }
    }
    
    public PageReference changePassword() {
        return Page.ChangePassword;
    }
    
    public void cancel() {
        isEdit=false;
        user = [SELECT id, email, username, communitynickname, timezonesidkey, languagelocalekey, firstname, lastname, phone, title,
                street, city, country, postalcode, state, localesidkey, mobilephone, extension, fax, contact.email
                FROM User
                WHERE id = :UserInfo.getUserId()];
    }
    
    private void setContactFields(Contact c) {
        c.title = user.title;
        c.firstname = user.firstname;
        c.lastname = user.lastname;
        c.email = user.email;
        c.phone = user.phone;
        c.mobilephone = user.mobilephone;
        c.fax = user.fax;
        c.mailingstreet = user.street;
        c.mailingcity = user.city;
        c.mailingstate = user.state;
        c.mailingpostalcode = user.postalcode;
        c.mailingcountry = user.country;
    }

    static testMethod void testSave() {         
        // Modify the test to query for a portal user that exists in your org
        User existingPortalUser = [SELECT id, profileId, userRoleId FROM User WHERE UserRoleId <> null AND UserType='CustomerSuccess' LIMIT 1];
        System.assert(existingPortalUser != null, 'This test depends on an existing test portal user to run');
        
        String randFax = Math.rint(Math.random() * 1000) + '5551234';
        
        System.runAs(existingPortalUser) {
            MyProfilePageController controller = new MyProfilePageController();
            System.assertEquals(existingPortalUser.Id, controller.getUser().Id, 'Did not successfully load the current user');
            System.assert(controller.isEdit == false, 'isEdit should default to false');
            controller.edit();
            System.assert(controller.isEdit == true);
            
            controller.cancel();
            System.assert(controller.isEdit == false);
            
            controller.getUser().Fax = randFax;
            controller.save();
            System.assert(controller.isEdit == false);
        }
        
        // verify that the user and contact were updated
        existingPortalUser = [Select id, fax, Contact.Fax from User where id =: existingPortalUser.Id];
        System.assert(existingPortalUser.fax == randFax);
        //System.assert(existingPortalUser.Contact.fax == randFax);
    }
}

 

 

The line highlighted in red is the error line.

 

Please help me.

 

Anyone else seeing this?

 

Occurs on "Edit" of Account that has the Edit button overridden to bring up an AccountEditVFPage.

 

Debug logs shows no error!

 

Ideas?

  • February 09, 2011
  • Like
  • 0

Hi,

 

How to have an explicit 'COMMIT' in Apex?

 

In before update trigger we need to check a condition, and if that condition is satisfied the value of a field has to be changed and an error has to be thrown. As the transaction will be commited in the last, the changes to the field are not being saved as an error will be thrown.Hence a mechanism to commit the change to field before throwing the error. Is there any such mechanism in Apex.

 

 

I am new to SFDC. I am using Developer Edition. My friends told me that i can create apex classes and triggers in the Developer Edition. But somehow when i login to DE and go to develop->apex triggers, i dont see the "new" button to create a trigger. What i am doing now is create a sandbox out of the DE and creating triggers there. So is there somethign i am missing? do i need to change any config settings to enable apex triggers in DE?

Here's my situation: I've got approx. 200K Accounts/Customers in my SFDC instance, and now need to calculate and assign a LCV (Lifetime Customer Value) to each of these. I've got the individual metrics and the LCV function defined. The plan is apply computeLCV() "one-time" to every existing customer in order that I have this value for all Accounts. Then, on an on-going basis I would use a "after update" trigger to re-calc LCV if any of the metric-bearing field change. Straightforward!

 

But, I'm not sure what's the correct approach to the handle the "one-time 200K Account" calculateLCV processing!! Should I:

 

1> Use scheduled Apex:

global class calculateLCV implements Schedulable { 
 global void execute(SchedulableContext ctx) {
 // Query/retrieve and calculate LCV for all 200K existing Account}

I could then schedule this job to run just once! After a successful run, delete it!

 

2> Use the Bulk API to extract and process the 200K Accounts

 

3> Some other alternative e.g. regular Apex, invoked via a button click to do the same thing (and later removed), or Anonymously execute some Apex code to achieve the desired calculation, etc.

 

Thanks for your suggestions!

  • February 02, 2011
  • Like
  • 0

Hi,

 

According to the following page Record Types should be supported in VF on version 20:

http://www.salesforce.com/us/developer/docs/pages/Content/pages_intro_whats_new.htm

 

Well, I have a VF page for MyObject__c with a picklist on it, and there's a Record Type against MyObject__c which filters the values in that picklist. When I open the page instead of seeing only the filtered picklist values all the values are displayed. This Record Type is set against the Sys Admin Profile and I am logged in with a User in that same profile. Btw both the VF page and its controller are on version 20 of the API.

 

Any ideas what could be the problem? Thanks!

Hi All,

 

I am getting the following Exception from a trigger that was till now functioning with no problem !

 

The trigger is a very simple one, deleting AccountShares when an Account_Team record is deleted...

 

I am getting the SELF_REFERENCE_FROM_TRIGGER exception and I really cannot understand why...

Any help would be really appreciated !

 

The debug log is the one I am getting when I try to delete one Account_Team record.

=============================

trigger trgAccount_Team_Before_Delete on Account_Team__c (before delete) {
      
        Set<ID> sAccId=new Set<ID>();
      Set<ID> sUId=new Set<ID>();
      for(Account_Team__c at:trigger.old){
        if (at.ftxt_AccOwnerID__c==at.User__c) continue;
        sAccId.add(at.Account__c);
        sUId.add(at.User__c);
      }
      ClsAccount_Team.syncDeletedAccountSharing(sAccId,sUId);
}

 

 

//----ClsAccount_Team.syncDeletedAccountSharing Code-----

    public static void syncDeletedAccountSharing(Set<ID> sAccId,Set<ID> sUId){
        delete [Select Id From AccountShare Where UserOrGroupId In: sUId And AccountId In: sAccId AND RowCause='Manual'];
    }

 

======DEBUG LOG=========

 

16.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;VALIDATION,INFO;WORKFLOW,INFO 10:38:15.291|EXECUTION_STARTED 10:38:15.291|CODE_UNIT_STARTED|[EXTERNAL]|TRIGGERS 10:38:15.291|CODE_UNIT_STARTED|[EXTERNAL]|01q200000000Fyi|trgAccount_Team_Before_Delete on Account_Team trigger event BeforeDelete for [a0G2000000Q1Z5R]

 

10:38:15.292|METHOD_ENTRY|[8]|SET.add(ANY) 10:38:15.292|METHOD_EXIT|[8]|SET.add(ANY) 10:38:15.292|METHOD_ENTRY|[9]|SET.add(ANY) 10:38:15.292|METHOD_EXIT|[9]|SET.add(ANY) 10:38:15.292|METHOD_ENTRY|[11]|01p20000000DuDc|ClsAccount_Team.syncDeletedAccountSharing(SET, SET) 10:38:15.293|SOQL_EXECUTE_BEGIN|[94]|Aggregations:0|Select Id From AccountShare Where UserOrGroupId In: sUId And AccountId In: sAccId AND RowCause='Manual'

 

10:38:15.415|SOQL_EXECUTE_END|[94]|Rows:1 10:38:15.415|DML_BEGIN|[94]|Op:Delete|Type:AccountShare|Rows:1

10:38:17.040|DML_END|[94]

10:38:17.041|EXCEPTION_THROWN|[94]|System.DmlException: Delete failed. First exception on row 0 with id 00r2000002JUOctAAH; first error: SELF_REFERENCE_FROM_TRIGGER, Object (id = a0G2000000Q1Z5R) is currently in trigger trgAccount_Team_Before_Delete, therefore it cannot recursively delete itself: [] 10:38:17.042|METHOD_EXIT|[11]|ClsAccount_Team.syncDeletedAccountSharing(SET, SET)

 

10:38:17.042|FATAL_ERROR|System.DmlException: Delete failed. First exception on row 0 with id 00r2000002JUOctAAH; first error: SELF_REFERENCE_FROM_TRIGGER, Object (id = a0G2000000Q1Z5R) is currently in trigger trgAccount_Team_Before_Delete, therefore it cannot recursively delete itself: [] Class.ClsAccount_Team.syncDeletedAccountSharing: line 94, column 3 Trigger.trgAccount_Team_Before_Delete: line 11, column 7

 

10:38:17.042|CUMULATIVE_LIMIT_USAGE 10:38:17.042|LIMIT_USAGE_FOR_NS|(default)| Number of SOQL queries: 1 out of 20 Number of query rows: 1 out of 1000 Number of SOSL queries: 0 out of 0 Number of DML statements: 1 out of 20 Number of DML rows: 1 out of 100 Number of script statements: 7 out of 10200 Maximum heap size: 0 out of 3000000 Number of callouts: 0 out of 10 Number of Email Invocations: 0 out of 10 Number of fields describes: 0 out of 100 Number of record type describes: 0 out of 100 Number of child relationships describes: 0 out of 100 Number of picklist describes: 0 out of 100 Number of future calls: 0 out of 10 Number of find similar calls: 0 out of 0 Number of System.runAs() invocations: 0 out of 20 10:38:17.042|CUMULATIVE_LIMIT_USAGE_END 10:38:17.042|CODE_UNIT_FINISHED|trgAccount_Team_Before_Delete on Account_Team trigger event BeforeDelete for [a0G2000000Q1Z5R]

Hi

I want to ask does Winter '11 removed time limits on Web Service callouts from Apex.

Please let me know the time limit in either case.


Thanks in advance.

 

  • October 27, 2010
  • Like
  • 0

Hello Folks,

 

I created a Visualforce wizard with 1 controller Class and 2 Visual Force pages.

 

 

Issue Description :

 

  • If i open the WizardPage1.page and the  Click Next button - my script Inserts a new account Record ,set a String property AccountId with the inserted Account's Id and redirect to WizardPage2 .
  • Now on WizardPage2  if i reload(F5 / Mouse RightClick "Reload /")the page .It inserts another account record. whereas i am expecting the "AccountId" property to retain the First inserted account (Seems it is getting reset on reload of page)
  • Then I added a "Back" button on WizardPage2 and tried  follwoing

 

    • Go to WizardPage1 Click Next - (Account Created) redirected to WizardPage2.
    • Clicked "Back" on WizardPage2 and reached WizardPage1.
    • From WizardPage1 again clicked Next and reached "WizardPage2.
    • Now if i Reload the page Account is not getting created again and i can access value of property "AccountId".
    •  

       

       

      Below is my controller and VF pages.

      ----------------------------------------------------------------------------------Class Start

      public with sharing class customWizardcontroller {
      public Account objBidpricing {get;set;}
      public String AccountId {get;set;}
      public customWizardcontroller()
      {
      try{
      objBidpricing = new Account(Name = 'Wizard testing');
      }
      catch(Exception e)
      {
      //Handle Exception  
      }
      }
      public Pagereference goNextStep()
      {
      try{
      if (AccountId ==  null ||  AccountId == '')
      {
      insert objBidpricing;
      AccountId = objBidpricing.Id;
      }
      return Page.WizardPage2;
      }
      catch(Exception e)
      {
      //Handle Exception
      }
      }

      public with sharing class customWizardcontroller {
      public Account objAccount{get;set;}

      public String AccountId {get;set;}

       

      //Constructor

      public customWizardcontroller()

      {

        try{

          objAccount= new Account(Name = 'Wizard testing');

                }

               catch(Exception e) { //Handle Exception   }

      }

      public Pagereference goNextStep()

       {

         try{ if (AccountId ==  null ||  AccountId == '')

        { insert objAccount; AccountId = objAccount.Id; }

       

        return Page.WizardPage2;

          }

               catch(Exception e) { //Handle Exception }

        }

       

      }

      ----------------------------------------------------------------------------------Class Ends

       

      ----------------------------------------------------------------------------------WizardPage1 Start

       

      <apex:page Controller="customWizardcontroller" >

      page1

      <apex:form id="quesAndAns">

       

      <apex:pageBlock title="Bid Pricing" id="pbBidPricing"> 

      <apex:pageblockbuttons >

      <apex:commandButton action="{!goNextStep}" value="Next" />

      </apex:pageblockbuttons>

      </apex:pageBlock>

      </apex:form>

       

      </apex:page>

       

      ----------------------------------------------------------------------------------WizardPage1 Ends

       

       

      ----------------------------------------------------------------------------------WizardPage2 Start

       

       

       

      <apex:page Controller="customWizardcontroller" >
       page2

       

      </apex:page>

       

       

      ----------------------------------------------------------------------------------WizardPage2 Ends

       


       

      If anyone already faced such issue or can figure out odd in my code please suggest.

       

      Thanks in advance.

      Nikhil

    • October 25, 2010
    • Like
    • 0

    Hello,

     

    I am developing a trigger that will give access to certain contact records that will meet some criteria. I need to update and insert a ContactShare object for the same. However I am getting a compilation error.

     

     

    Error: Compile Error: Field is not writeable: ContactShare.ContactId at line 8 column 9

     

     

    trigger Share_Contact_For_Account on Contact (after insert, after update) {
    
        for (Contact c : Trigger.new) {
    
    
            ContactShare cs = new ContactShare();
    
            cs.ContactId = c.Id;
            cs.ContactAccessLevel = 'Edit';
    
    
        }
    }

     

     Thanks

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    My production instance exceeded my data storage limits, but since I never received any notifications this went unnoticed until I refreshed my FULL sandbox. This full sandbox was unusable because I kept getting the "Data Storage Limit Exceeded" exception.

     

    I've since deleted objects from Production to bring the total storage in compliance with limits, but I CANNOT refresh my sandbox for another 29 days! Thus, my full sandbox sits useless, cause it still reflects a data storage limit exceeded state.

     

    What's the resolution? Wait patiently for 29 days before I can get to use my full sandbox again? Thanks.

     

    --Boman.

    • May 26, 2010
    • Like
    • 0

    I'm opening a new window using JS sitting  behind a custom button on Account using:

     

    window.open(woURL,"_blank","toolbar=no, titlebar=yes location=yes, directories=no, status=no, scrollbars=yes, menubar=no, copyhistory=yes, resizable=yes, width=1000, height=375");

    The woURL points to a VF page, for which I have:

     

    <

    apex:page title="MyTitle" controller="WOController" showHeader="false" standardStylesheets="true" tabStyle="Account">

     

    No matter what I've tried so far - various options in the JS code and on the VF page, but I just cannot get the Title to show up in IE.

     

    Suggestions? Thanks.

     

    --Boman.

    • May 25, 2010
    • Like
    • 0