• JimRae
  • PRO
  • 3282 Points
  • Member since 2008


  • Chatter
    Feed
  • 124
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 12
    Questions
  • 891
    Replies
If I have a static method on an Apex class, can I use it in an Approval Process's entry criteria?

Hello,

 

Is there a way to find only those Accounts which have an Activity of a certain type in their ActivityHistory and exclude the ones that don't?

 

My current query looks like this:

 

SELECT Id, Name, ( SELECT Id, ActivityType, ActivityDate, Description, Status, Owner.Id, Owner.Name FROM ActivityHistories WHERE ActivityType = 'my_activity_type' ORDER BY

ActivityDate DESC ) FROM Account



What I want is only Accounts where ActivityHistories is not empty. e.g WHERE AccountHistories != null or so.

 

I know that I could just collect the Ids of the relevant accounts manually and do a second query. But since the number of Accounts in the system is > 40000 I'd rather get it all done in one step.

 

Thank you for your help!

 

Hi all - I'm having trouble writing a test class for the following apex code:

 

trigger LastSWDate on Task (after insert, after update) {
  
  
  //To do - If the subject of a completed task contains "SW", put the date of the completed task in the 
  //the "Last_SW_Activity__c" field on the account object

//Create a set of related account ID's
Set <ID> acctIDs = new Set <ID> ();


//For every task, add it's related to account ID to the set
  for (Task t: Trigger.new){
    acctIDs.add(t.accountID);
//Create a map to match the task related to ID's with their corresponding account ID's
    Map<ID, Account> acctMap = new Map<ID, Account> ([Select ID, Last_SW_Activity__c from Account where ID in :acctIDs]);
//Create the account object
      Account acctRec = acctMap.get(t.accountID);

//If the account ID isn't null, the subject line starts with "sw", and the task has been marked as completed    
  If ((t.accountID != null) &&(t.subject.indexOf('sw')==0) && (t.Status == 'Completed'))
//Check to see if the Last_SW_Activity__c field is current compared with the latest completed activity
      If (acctMap.get(t.accountID).Last_SW_Activity__c < t.LastModifiedDate || acctMap.get(t.accountID).Last_SW_Activity__c ==null){
//Update the Last_SW_Activity__c field on the account object with the task's end date  
        acctrec.Last_SW_Activity__c = t.LastModifiedDate;
        update acctRec;
    }
  }
}

 Can somebody please help take a stab at a test class for this?  I would really appreciate it!  Thanks!

  • August 30, 2011
  • Like
  • 0

Hi!

 

I need to upload a 22MB file to Document. Uploading this PDF to File or Content is the last option but before that, i'd like to ask if anyone has an idea on how to bypass the 5MB limit for documents?

 

Than kyou!

Hi

 

Is it possible to view the code for a page developed using the standard Salesforce tools?

 

I'm hoping to use this as the basis for a new visualforce page as it doesn't quite give me the UI i'm after.

 

Thanks for any suggestions.

Paul

  • August 26, 2011
  • Like
  • 0

Hi,

 

I have over 1.5 million records. When I tried to export using dataloader, the extracted .csv file displays only 1048576 records as this is the maximum an excel can display. What can I do to get all my records? 

 

Is there a way to import files from salesforce to MS Access directly?

 

Thank you.

 

 

I created an apex class in my Sandbox. I got a code coverage of 81%. I pushed the Controller into my production. However, when I go to my production inbound and try to deploy it I get this error message: "Failure Message: "System.DmlException: Insert failed. First exception on row 0; first error: INVALID_CROSS_REFERENCE_KEY, invalid cross reference id: []", Failure Stack Trace: "Class.extFindJob.testPageMethods: line 36, column 6 External entry point"

 

I understand the error. I am using a developer mode Sandbox, so the records from my objects are not pulled. But, I cannot bypass setting a test value for my Account__c field its a mandatory field.

 

Please help me find a solution. Thank you for any help.

Hi,

 

Being an admin, I can see 'Active' field at the user record but it is not visible to other users.

 

SFDC does not have any way to set field level security for 'Active' field which is at user object. Also this field is not available so I could add to the user page layout.

 

Any help, how to 'Active' field visible to all users.

 

Thanks

  • February 23, 2011
  • Like
  • 0

Not sure what I am missing here - this seems simple enough...

 

I have a MVP Picklist field called Languages__c. I want to split the field into a String List using ';' as the split. But when Languages has more than ten entries, ther debug shows me that the List contains the first ten, and then the characters  ', ...)'

 

What I am missing here? What can I do to make sure all the values end up in the array?

 

 

public class cSearch{
        Public String [] languagesvalue{get;set;}    
         
        
        //This is the contructor method to build the search filters
        public cSearch(Contact con,Contact formatch){ //set search fields = values on contact being searched           
                   
            languagesvalue = new String [] {} ;
            if (con.Languages__c != null) {
            String [] sissues = con.Languages__c.split(';');
            for (String s: sissues) {
            languagesvalue.add('\'' + s + '\'');
            }           
            }

 

 

Greetings, my fellow salesforce users,

 

I don't know how but events that I added via API in public calendars have suddenly stopped showing in public calendars. The funny thing is, even though if I query "Event" object, I don't get any records but if I enter that event's id in address bar, it takes me to that event details page. How is this possible?

 

I have that event's id saved someplace else, and I am getting that event's id. Its details page exist but I cannot, for the life of me, access it via calendar or via query. It behaves as if that event simply does not exist. 

 

Any help would be immensely appreciated.

I've created an automatic approval process trigger, which works, but I'm running into a snag in that it will throw up errors later when the Opportunity is edited after approval and maybe at other points in time.  The trigger is supposed to run if the opportunity is updated and the field Risk Build is changed to "Yes".  That works but it should only run if the field Risk Build is actually changed to yes from either being blank or from No.  It should not run if it is already at Yes and the user simply edits a different part of the opportunity (such as the stage).  Is there some kind of "ischanged" function like you can use for workflows and formulas? Ideally I need it to say that Risk Build is changed AND changed to "yes".  The code (see below) is pretty simple thus far so hopefully the answer is something simple too.

Thanks,

Amanda

 

 

trigger Risk_Build_Approval on Opportunity (after update) 
{
  for(Opportunity o: trigger.new){ 
  if(o.risk_build__c == 'Yes')
  {
    O = [ select ID from Opportunity where id in :Trigger.new ];
  Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest();
  req1.setComments('Submitting request for approval.');
  req1.setObjectId(o.id);
   Approval.ProcessResult result = Approval.process(req1); 
   System.assert(result.isSuccess());        


  }
  }
  }

String processig at character level, is there any reason why the character level manipulation is missing in String in apex?

 

ex: String temp = 'apex string';

 

temp.charAt(0)

 

 

 

I have a trigger calling an @future method.  The trigger fires correctly, it correctly calls the @future method (processCarsTrans(SET <Id>), see below), but it appears the code inside the @future method never runs.  The first line in processCarsTrans is a System.debug line, which does not appear in the System log.  All I see in the log is:

 

10:12:54.502|METHOD_ENTRY|[35,13]|01pQ00000004lsH|SumCarsTransMethods.processCarsTrans(SET<Id>)
10:12:54.643|METHOD_EXIT|[35,13]|SumCarsTransMethods.processCarsTrans(SET<Id>)

 

It appears no code has run in the processCarsTrans method.  Shouldn't I be able to see the same kind of log with an @future method as I do with one that is not @future?  In the Syetem Log I do not a FUTURE line, indicating the async code is ever getting executed.  How do I get this @future method to run and log its behavior so I can test it?

 

 Any help is greatly appreciated.

  • July 25, 2010
  • Like
  • 0

hi. i have a problem with a select: //buscar a Margem PRIO consoante o produto
                Parametros_fixos_Pricing__c pfp_margem =
                //List<Parametros_fixos_Pricing__c> pfp_margem =
                [select margem_prio__c
                from Parametros_fixos_Pricing__c
                where produto__c = :pr2.id AND
                Centro_de_carga2__c = :ccd.Centro_de_Carga__c AND
               t__c = '012Q00000008aTE' AND
                
                
                Valido_ate__c >= today AND
                Valido_de__c <= today  ];

 

When the trigger runs, i get a error on the select above: to many soql: 21

someone can help me?

 

----------------------------------------this is my code---------------------------------------------------------------

trigger InserePrecoCompraOuPrecoVenda on Pricing__c (after insert) {
    for (Pricing__c pr : Trigger.new){
        if(pr.TR_background__c == 'Platts'){
    //já tenho aqui disponivel o valor final do platts na variavel pr.preco_final__c
    
            //construção da lista de produtos
            List<Product2> produtos = new List<Product2>();
            produtos = [Select id,Produto_Referencia_Preco_de_venda__c,
            iva__c from Product2 where Produto_Referencia_Platts__c = :pr.produto__c AND
            Grupo_de_Materiais__c = ''];
                            
                           
            if (produtos.isEmpty() == false){
            
                for(Product2 pr2 : produtos){
                //PVP REf para o produto
                Pricing__c pricing_pvp_ref
         
               = [select preco_final__c from Pricing__c where
                produto__c = :pr2.Produto_Referencia_Preco_de_venda__c AND
                TR_background__c = 'Preço de Venda' AND
              
                  Valido_ate__c >= today AND
                 Valido_de__c <= today
                    
                    ];
                //construção CCD para o produto
                    List<Centros_de_Carga_Disponiveis__c> CcDisponiveis =[select Centro_de_Carga__c from Centros_de_Carga_Disponiveis__c
                    where Produto__c =:pr2.id];
                //Fazer o Loop à tabela de centros de carga
              // if (CcDisponiveis.isEmpty() == false ){
               
                for(Centros_de_Carga_Disponiveis__c ccd : CcDisponiveis){
                    
                //buscar os dados anuais para cada centro de carga
                 Parametros_fixos_Pricing__c pfp =
                [select CSR_m__c,Fee_Instalacao_m__c,ISP_m__c,Spread_m3__c
                from Parametros_fixos_Pricing__c
                where
                tr_background__c = 'Parametros Anuais' AND
                produto__c = :pr2.id AND
                Centro_de_carga2__c = :ccd.Centro_de_Carga__c AND
                Valido_ate__c >= today AND
                Valido_de__c <= today ];
                 
                //buscar a Margem PRIO consoante o produto
                Parametros_fixos_Pricing__c pfp_margem =
              
                [select margem_prio__c
                from Parametros_fixos_Pricing__c
                where produto__c = :pr2.id AND
                Centro_de_carga2__c = :ccd.Centro_de_Carga__c AND
               t__c = '012Q00000008aTE' AND
                
                
                Valido_ate__c >= today AND
                Valido_de__c <= today  ];
              
                
                //Inserção do registo no objecto Pricing Produto final  
                Pricing_Produto_Final__c  ppf = new  Pricing_Produto_Final__c();                      
                ppf.produto__c =pr2.id;
                ppf.preco_de_compra__c=pr.preco_final__c + pfp.CSR_m__c +
                                         pfp.Fee_Instalacao_m__c + pfp.ISP_m__c + pfp.Spread_m3__c;
                ppf.Centro_de_carga2__c = ccd.Centro_de_Carga__c;
                ppf.margem_prio__c = pfp_margem.margem_prio__c;
                ppf.pvp_ref__c = (pricing_pvp_ref.preco_final__c*1000) /(1+ (pr2.iva__c*0.01));
                ppf.valido_de__c = pr.valido_de__c;
                ppf.valido_ate__c = pr.valido_ate__c;
                insert ppf;    
        
                }                          
               
           // }

        }
        }
        }
    }
}

Hello all,

 

I am trying to create a trigger that sets a Currency Field in the Object, to the result of what a formula was.  The issue is that when i do this, it says 

 

Error:Apex trigger UpdatePriceValue caused an unexpected exception, contact your administrator: UpdatePriceValue: execution of AfterUpdate caused by: System.Exception: Record is read-only: Trigger.UpdatePriceValue: line 4, column 3

 

Any way around this?  I have the code below:

 

 

trigger UpdatePriceValue on Services_Selection__c (after insert, after update)

{

for (Services_Selection__c SS : Trigger.new)

{

SS.Price_Value__c = SS.Price_Formula__c;

}

}

 

Thanks in advance, to anyone who can help resolve this small issue.

 

 

  • April 27, 2010
  • Like
  • 0

Hey all... I'm running into some strange phenomena...

 

 

I have a VF page like so:

 

<apex:page standardController="workOrder__c"   extensions="workOrderController" action="{!init}">
<apex:variable value="{!workOrder__c}" var="wrk"/>

<apex:sectionHeader title="Work Order" subtitle="{!wrk.name}"/>

{!hasShp}

</apex:page>

 

 

And the extension as such:

 

public with sharing class workOrderController {

public woJct__c [] jcts = new woJct__c[0];

private workOrder__c workOrder;

//If the jcts list contains any relatedToObject__c = "Shipment__c", then set this as true
//so I can render that component
public boolean hasShp = true;

//If the jcts list contains any relatedToObject__c = "Terminal_prep_order__c"
//then set this as true so I can render the component
public boolean hasTrmPrp = true;

//Make sure we can use this page as an extension on and above the standard controller
public ApexPages.StandardController controller;
public workOrderController(ApexPages.StandardController controller)
{
this.controller = controller;

workOrder = (workOrder__c)controller.getRecord();
}

public void init()
{
if (workOrder.Status__c == 'New')
{
if (workOrder.OwnerId == UserInfo.getUserId()) {
workOrder.Status__c = 'Open';
update workOrder;
}
}
UpdateBooleans();
}

private void UpdateBooleans()
{
woJct__c[] jctsShipment = [
SELECT Id
FROM woJct__c
WHERE workOrder__c = :workOrder.Id AND relatedToObject__c = :'Shipment__c'];
hasShp = jctsShipment.size() > 0;

woJct__c[] jctsTerminal = [
SELECT Id
FROM woJct__c
WHERE workOrder__c = :workOrder.Id AND relatedToObject__c = :'Terminal_prep_order__c'];
hasTrmPrp = jctsTerminal.size() > 0;
}

//This gets all the woJcts - If there is a better way, please do it.
public woJct__c[] getJcts(){
jcts = [
select id, name, relatedToId__c, relatedToName__c, relatedToObject__c, complete__c
from woJct__c where workOrder__c = :ApexPages.currentPage().getParameters().get('id')
];
return jcts;
}

}

 

 

When I add {!hasShp} to the VF page, I get the following error:

 

Error: Unknown property 'workOrder__cStandardController.hasShp'

 

It makes no sense to me! Please help!

 

thanks!

  • April 23, 2010
  • Like
  • 0

Hello,

 

Im using the Force.com IDE for writing Apex code. Is there any way to write debug statements to print a value to the console ?. An example would be really appreciated.

 

Thank You

  • April 09, 2010
  • Like
  • 0

Hi there,

 

I have the following controller extension, and corresponding unit test. I want to find out why the assertion fails. How do I initialize the controller in the right way, so that the getAt() function sends back the correct account name?

 

extension class:

 

public class childAccount {
    
    private List<Account> acctz;
    private Account acct; 

    public childAccount(ApexPages.StandardController controller) {
        this.acct= (Account)controller.getRecord();
    }
    
    public String getAt()
    {
        Account[] at = [Select name FROM Account where id= :acct.id];
    	if(at.size()>0){
    		return at[0].Name;
    	}
    	else{
    		return null;
    	}
    }
            
    public List<Account> getAcctz()
    {
        Account act = [Select id FROM Account where id = :acct.id];
        acctz = [Select id, Name, Address_Street__c, Address_City__c, Office__c, Type, parentid, Ownerid from Account where parentid = :act.id];
    	return acctz;
    }
}

 

test class:

 

@isTest
private class childAccountTest {

    static testMethod void myUnitTest() {    	
    	
    	Account a = new Account(Name='Test Account');
    	
		ApexPages.StandardController sc = new ApexPages.StandardController(a);
		childAccount cont = new childAccount(sc);
		
		system.assertEquals(a.Name,cont.getAt());
    }
}

 

 

 

Hi,

 

I have the following Query where I want to get latest and oldest date of entry how can I get that

 

 

Date dat= [select max(Pack__Date_of_Entry__c) from Pack__TCI__c].Pack__Date_of_Entry__c; Date dat= [select min(Pack__Date_of_Entry__c) from Pack__TCI__c].Pack__Date_of_Entry__c;

 But the aggregate function does not seem to be working on Date type

 

 

Secondly, I want to display an already generated report in a visualforce page I have developed. Is it possible if yes please tell me how...

 

 

  • March 25, 2010
  • Like
  • 0

Hi,

 

I am building a visualforce page.Let me explain the use-case:

 

I need to create a visualforce page, which will be embedded as a custom link on opportunity record.

I am using standard controller of Opportunity.

 

Now, salesforce gives us OpportunityContactRole, which gives contacts associated with the opportunity.

But, this does not give all the information related to a contact,Like email address, phoneNo or any other custom fields on the contact.

 

In the visualforce page i also need to  displaythe contact's other information.

 

I tried extending the standardcontroller and doing a semi join with opportunitycontactrole, but was not able to pull off.

 

Here is the query: [select Contact.email from Contact where Id in (Select ContactId from OpportunityContactRole where OpportunityId='SomeId')].

 

How can i accomplish this? any ideas/help on this is greatly appreciated.

 

Here is the VF code:

 

 <apex:Page standardcontroller="Opportunity">

<apex:pageBlock Title="Contacts" >
        <apex:pageblockSection Columns="2" >
            <apex:pageBlockTable value="{!Opportunity.OpportunityContactRoles}" var="cts">           
                <apex:column headerValue="Contact Name">
                    <apex:outputText value="{!cts.Contact.Name}">
                    </apex:outputText>
                 </apex:column>
                 <apex:column headerValue="Contact Role">
                    <apex:outputText value="{!cts.Role}">
                    </apex:outputText>
                 </apex:column>                
            </apex:pageBlockTable>                                           
        </apex:pageblockSection>                                                           
    </apex:pageBlock> 
 </apex:Page>

 

Thanks in Advance!

Sales4ce

Message Edited by sales4ce on 03-24-2010 02:24 PM

I have a VF and apex solution that generates a new url and redirects the user to a new create contact page via a button.  In addition, it prepopulates several of the values from the calling record.  When I try to pass the Account id via the con4_lkid field, I get an error that states:

 

Data Not Available The data you were trying to access could not be found. It may be due to another user deleting the data or a system error. If you know the data is not deleted but cannot access it, please look at our support page.

Click here to return to the previous page. 

 

if I remove the reference to the con4_lkid (which is a lookup to the Account master for the contact) then the page displays properly, but the lookup field is not prepopulated.  

Anyone else run into this, and if so, how did you fix it?

TIA

 

 

 

  • December 09, 2009
  • Like
  • 0

My original requirement was to figure out how to pass a multiselect picklist from a calling object to a new object.  I have a custom object that has several fields I need to pass to a new Event object. I used to do this with an scontrol that created a URL querystring with all of the parameters.  This works OK, but is not going to be supported forever. SFDC Support suggested replacing this with a VF and apex solution.  My original attempt used a VF page with a page level Action that called a method in my controller to build a new pagereference back to the new event page.  This works great, except for the multiselect picklist.  The multiselect picklist is passed in the URL by duplicating the same field id multiple times, once with each value of the multiselect picklist.  Support says that using the field ids (gathered using firebug on the standard page, is not supported, and suggested that I should create a custom version of the event view, and leverage a shared controller to pass the data.

I am working this solution, but have two areas that I haven't figured out.

How do I replicate the "Recurrence" section of the standard page?

How do I replicate the "Add Invitees" section of the standard page?

 

Anyone have any ideas on how to solve the original problem, or the new ones?  Any sample code would be appreciated.

 

Message Edited by JimRae on 12-03-2009 05:41 PM
  • December 03, 2009
  • Like
  • 0

I have a standard Account controller VF page, and reference the contacts related list in a pageblock table.

I have a button on the standard layout to display the page, and it should show all of the contacts, but it doesn't, it only shows  the first 2 retrieved. I tried this with Opportunities as well, and have the same result.

 

Any ideas?

 

Here is a code sample:

 

 

<apex:page standardController="Account" tabStyle="Account" sidebar="false" showHeader="false"> <apex:form > <apex:pageBlock title="Account Summary"> <apex:pageMessages /> <apex:pageBlockButtons location="top"> <input type="button" value="Print Screen" onClick = "window.print()"> </input> </apex:pageBlockButtons> <apex:pageBlockSection title="Account Detail" collapsible="true"> <apex:outputField value="{!Account.Name}"/> <apex:outputField value="{!Account.Geography_Account__c}"/> <apex:outputField value="{!Account.Phone}"/> <apex:outputField value="{!Account.SalesRegionAcct__c}"/> <apex:outputField value="{!Account.Website}"/> <apex:outputField value="{!Account.Fortune_500__c}"/> <apex:outputField value="{!Account.TickerSymbol}"/> <apex:outputField value="{!Account.AnnualRevenue}"/> </apex:pageBlockSection> <apex:pageBlockSection title="Account Profile" columns="1" collapsible="true"> <apex:outputField value="{!Account.Company_Overview__c}"/> <apex:outputField value="{!Account.Company_Offerings__c}"/> <apex:outputField value="{!Account.Key_Business_Applications__c}"/> <apex:outputField value="{!Account.Competitors_Software_Installed__c}"/> </apex:pageBlockSection> </apex:pageBlock> <apex:pageBlock title="Action Plans"> <apex:pageBlockTable value="{!Account.Action_Plans__r}" var="actplan"> <apex:column value="{!actplan.Name}"/> <apex:column value="{!actplan.Responsible__c}"/> <apex:column value="{!actplan.Target_Date__c}"/> <apex:column value="{!actplan.Completed_Date__c}"/> <apex:column value="{!actplan.Comments__c}"/> </apex:pageBlockTable> </apex:pageBlock> <apex:pageBlock title="Assets"> <apex:pageBlockTable value="{!Account.Assets}" var="asts"> <apex:column value="{!asts.Name}"/> <apex:column value="{!asts.Market__c}"/> <apex:column value="{!asts.Product_Family__c}"/> <apex:column value="{!asts.Maintenance_Date__c}"/> <apex:column value="{!asts.Maintenance_Status__c}"/> </apex:pageBlockTable> </apex:pageBlock> <apex:pageBlock title="Contacts"> <apex:pageBlockTable value="{!Account.Contacts}" var="cont"> <apex:column value="{!cont.Name}"/> <apex:column value="{!cont.Active__c}"/> <apex:column value="{!cont.Title}"/> <apex:column value="{!cont.Email}"/> <apex:column value="{!cont.Phone}"/> <apex:column value="{!cont.Comments__c}"/> </apex:pageBlockTable> </apex:pageBlock> <apex:pageBlock title="Opportunities"> <apex:pageBlockTable value="{!Account.Opportunities}" var="opps"> <apex:column value="{!opps.Name}"/> <apex:column value="{!opps.Type}"/> <apex:column value="{!opps.StageName}"/> <apex:column value="{!opps.Amount}"/> <apex:column value="{!opps.CloseDate}"/> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>

 

 

 

  • April 26, 2009
  • Like
  • 0

Is there a limit to the number of items that can be pulled into a project?  I was trying to extract all of the reports in my environment, so I can look at some specific items, and when I do the metadata update, I get all of the report folders, but most of them are empty.

 

  • April 07, 2009
  • Like
  • 0
How do I change the running user of the batch jobs being executed by CronKit?
I have a batch job that processes records and sends an email with the results, but it sends from my name. I would like to change it to a general administration account.

Other than this, it has been an awesome utility.
  • January 15, 2009
  • Like
  • 0
Does anyone have a method for getting a wrapper class "object" to emulate an sObject, so that the fields have inputfield support on a VF page?
I have searched, and it appears you need to implement an instance of an object, and bind the fields to the objects fields, but I can't seem to make this work.  Anyone ever do this?  have sample code?

My actual requirement is this, I have a custom object and want to have a VF page for creation and editing.  one section of the page is a grid with multiple rows of the same data (in the object they are labeled like this: valA1,valB1,valC1,valA2,valB2,valC2 etc).  A is a string field, B is a lookup and C is a date.

Any thoughts or suggestions would be greatly appreciated.

Jim

  • January 08, 2009
  • Like
  • 0
I have an inbound email service that is supposed to accept emails from our legacy system and process some system updates (a poor mans synchronize).  When the legacy system sends the mesage, we get the error:


554 Transaction failed: xxxx is not authorized to send emails to this service.


Originally, the service was set up to accept messages only from this address, and the administration address. I have also tried removing any "accept email from" addresses, leaving the service wide open (not desired, but for testing purposes).  When I send form the admin email address it works fine, but from my legacy system email, I get the error.

Has anyone else run into this type of issue, and if so, how was it resolved? I have had a case open with support for several weeks, but they have not been able to address the issue.

Anyone?

Thanks in advance for your help.


Message Edited by JimRae on 12-10-2008 09:09 AM
  • December 08, 2008
  • Like
  • 0
Anyone out there ever do anything with processing the data in an email attachment.
Here is my scenario:  We want to create an inbound email service that receives emails from our old system, including a CSV file as an attachment.  The CSV file contains new and updated opportunity records.  I would like to be able to read the file out of the email, and process the records, doing validation and upserting them to the database.

Anyone???

Thanks in advance!
  • November 07, 2008
  • Like
  • 0
I am trying to understand if the "Without sharing" keyword will allow me do accomplish something I am trying to do with a VF page with a custom controller.
What my goal is, is to send a link to a base user that includes a link to my custom VF page, and include an id to an object that they would not normally have visibility to, for example, opportunities.
 
According to Premier support, "without sharing" executes under the System User, ignoring all CRUD, field level and row-level security. 
 
This would seem to do what I am trying to do.  However, I get an insufficient privileges error when a base user tries to access the page with an object id that they don't normally have access to.
 
Is this NOT with the "with sharing" or "without sharing" mean?  If it isn't, what is the purpose of these keywords and how are they used?
 
Regards,
Jim
  • October 20, 2008
  • Like
  • 0
My pages stopped working this morning indicating that the Strength attribute was invalid for the pagemessage tag.  When I look at the Component reference for apex:pagemessage it is now completely blank.

Anyone else seeing this? 
I am on the cs2 (DEV) development sandbox.

Jim
  • September 10, 2008
  • Like
  • 0
I hope someone can help me.  I have a VF page that includes 4 tabbed sections.  One of them is a custom search tab.  When the user types their criteria (an account name) into the inputtext box, and clicks my search button, everything works great.  If the user types in their criteria, then presses "Enter",  the page refreshes and takes the user back to the first tab (my search tab is the fourth tab).
How can I get pressing enter to be the same as clicking the button?

Thanks in advance!!

Jim
  • August 27, 2008
  • Like
  • 1
I have created a Contact trigger that follows very closely to the cookbook Lead Duplicate Preventer code base.  It works fine and I have been able to deploy it to my production environment.  Now, I have some users that get the Query Exception error, and others that do not, even when adding the same new contact to the same account.  I can replicate this in both Dev and production, but can't figure out what the difference between users is, or what the user would have to do with the way the query executes.  I know the email field is not indexed, and that might be part of the problem, but am unclear as to why some users can execute successfully, and others get the error.  I hope that someone can help, and that this might be a good trigger that the entire SFDC Community can leverage.
Code is below!
Regards,
Jim Rae
 
 
Code:
TRIGGER CODE:

trigger ContactDuplicatePreventor on Contact (before insert, before update) {

    Map<String, Contact> ContactMap = new Map<String, Contact>();

    for (Contact contact : System.Trigger.new) {    

        // Make sure we don't treat an email address that
        // isn't changing during an update as a duplicate.

        if ((Contact.Email != null) && (System.Trigger.isInsert || (Contact.Email != System.Trigger.oldMap.get(Contact.Id).Email))) {
    
            // Make sure another new Contact isn't also a duplicate

            if (ContactMap.containsKey(Contact.Email)) {
                String errortext = 'Another new Contact has the same email address. ('+Contact.Email+') Please search for the existing Contact record with this address and update as appropriate, or contact your Administrator for assistance';
                Contact.Email.addError(errorText);
            } else {
                ContactMap.put(Contact.Email, Contact);
            }
        }
    }

    // Using a single database query, find all the Contacts in
    // the database that have the same email address as any
    // of the Contacts being inserted or updated.
 for(String test:ContactMap.keySet()){
 system.debug('\n\nContact added to Map was:'+test);  //only here for testing purposes
 system.debug('\n\nUser running trigger is:'+UserInfo.getUserName());
 system.debug('\n\n'+UserInfo.getProfileId());
 }
    for (Contact contact : [SELECT Email FROM Contact WHERE isDeleted = false and Email != null and Email IN :ContactMap.KeySet()]) {
        SYstem.debug('In the test loop');
        Contact newContact = ContactMap.get(Contact.Email);
  String errortext = 'Another Contact has the same email address. ('+newContact.Email+')  Please search for the existing Contact record with this address and update as appropriate, or contact your Administrator for assistance';
        newContact.Email.addError(errorText);
    }

TEST CASE CODE:
public class testBlockDuplicateContactEmails {
 
 static testMethod void testDuplicateContactEmailTrigger(){  
 
  //Creating all records against "Acme Corporation - HQ" Account (00100000002qK3l)
  Contact[] smith1 = new Contact[]{
   new Contact(  Email='smith@acme.org', LastName='Smith', Accountid='00100000002qK3l' )
  };
  insert smith1;  // add a known Contact
  
  Contact[] smith2 =new Contact[]{
   new Contact(  Email='smith@acme.org', LastName='Smith', Accountid='00100000002qK3l' )
  };
  // try to add a matching lead
  try {
   insert smith2;
   } catch (System.DmlException e) { 
   String errortext1 = 'FIELD_CUSTOM_VALIDATION_EXCEPTION, Another Contact has the same email address';
   system.debug('INSERT ERROR MESSAGE IS:'+e.getMessage());
   system.assert(e.getMessage().contains(errortext1), e.getMessage());
  }
  
  // test duplicates in the same batch for bulk Contact loading or lead conversion
  Contact[] bulkcontacts =new Contact[]{
   new Contact(  Email='Johnson@acme.org', LastName='Johnson', Accountid='00100000002qK3l' ),
   new Contact(  Email='Johnson@acme.org', LastName='Johnson', Accountid='00100000002qK3l' )
  };  
  try {
   System.debug('\n\n Insert Test');
    insert bulkcontacts;
    } catch ( System.DmlException e) { 
   String errortext2 = 'FIELD_CUSTOM_VALIDATION_EXCEPTION, Another new Contact has the same email address';   
   system.assert(e.getMessage().contains(errortext2), e.getMessage());
  }
  
  // test update also
  Contact[] contactup = new Contact[]{
   new Contact(  Email='jones@acme.org',  LastName='Jones', Accountid='00100000002qK3l' )
  };
  System.debug('\n\n Update Test');
  insert contactup;
  Contact updatetest = [ select id,Email from Contact where Email = 'jones@acme.org' and Accountid='00100000002qK3l' limit 1];
  system.assert(updatetest!=null);
  updatetest.Email = 'smith@acme.org'; 
    
  try { update updatetest; } catch ( System.DmlException e) { 
   String errortext3 = 'FIELD_CUSTOM_VALIDATION_EXCEPTION, Another Contact has the same email address';
   system.debug('UPDATE ERROR MESSAGE IS:'+e.getMessage());
   system.assert(e.getMessage().contains(errortext3), e.getMessage()); 
  }
  // Try a null email address
  Contact[] contactnull = new Contact[]{
   new Contact(  LastName='Anderson', Accountid='00100000002qK3l' )
  };
  System.debug('\n\n Null Test');
  try{ insert contactnull;} catch( System.DmlException e){
   system.debug('\n\nNull Insert ERROR MESSAGE IS:'+e.getMessage());
  }
  // Try a null email address Update
  Contact[] contactnull2 = new Contact[]{
   new Contact(  LastName='Anderson', Accountid='00100000002qK3l' )
  };
  System.debug('\n\n Null Update Test');
  insert contactnull2;
  Contact updatetest2 = [ select id,Email from Contact where Email=null and LastName = 'Anderson' and Accountid='00100000002qK3l' limit 1];
  system.assert(updatetest!=null);
  updatetest2.FirstName = 'Hans'; 
    
  try { update updatetest2; } catch ( System.DmlException e) { 
   system.debug('UPDATE ERROR MESSAGE IS:'+e.getMessage());
    
  }
 }
}

 
I hope someone can help me.  I have a VF page that includes 4 tabbed sections.  One of them is a custom search tab.  When the user types their criteria (an account name) into the inputtext box, and clicks my search button, everything works great.  If the user types in their criteria, then presses "Enter",  the page refreshes and takes the user back to the first tab (my search tab is the fourth tab).
How can I get pressing enter to be the same as clicking the button?

Thanks in advance!!

Jim
  • August 27, 2008
  • Like
  • 1
I was trying to create test class and I am getting an error saying : Methods defined as testmethod do not support web service callouts. I am pasting my APEX Code below please help me out from here.

global class sendToEncompass{
  
  // @future(callout=true)
  public String EncompassMSG;
   WebService static String basicCallout(String OppID){
  
     opportunity opp = [select id, Loan_Number__c,Borrower_SSN__c, Co_Borrower_First_Name__c, Co_Borrower_Last_Name__c, Co_Borrower_SSN__c, Borrower_Email__c, Borrower_First_Name__c, Borrower_Last_Name__c, owner.email, Subject_Property_Street__c, Subject_Property_City__c, Subject_Property_Zip__c, Processing_Notes__c from Opportunity where id =:OppID];
    
     HttpRequest req = new HttpRequest();
     req.setClientCertificateName('websvcs_cert');
     req.setEndpoint('https://api.XXXYYY.com/eupdate/EUpdateService.svc/insertUpdateLoans');
     req.setMethod('POST');
     req.setHeader('Content-Type', 'application/xml');
     req.setTimeout(120000);
     req.setBody(
     '<LoanEntries xmlns="http://schemas.XXXYYY.org/2001/07/EncompassService">' +
  '<LoanData>' +
  '<LoanField>' +
      '<field_id>CX.SALESFORCELINKIDATE</field_id>' +
      '<field_value>'+System.now().format('MM/dd/yyyy')+'</field_value>' +
    '</LoanField>' +
   '<LoanField>' +
      '<field_id>LoanOfficer</field_id>' +
      '<field_value>'+opp.owner.email+'</field_value>' +
    '</LoanField>' +
    '<LoanField>' +
      '<field_id>36</field_id>' +
      '<field_value>'+opp.Borrower_First_Name__c+'</field_value>' +
    '</LoanField>' +
    '<LoanField>' +
      '<field_id>37</field_id>' + 
      '<field_value>'+opp.Borrower_Last_Name__c+'</field_value>' +
    '</LoanField>' +
    '<LoanField>' +
      '<field_id>11</field_id>' + 
      '<field_value>'+opp.Subject_Property_Street__c+'</field_value>' +
    '</LoanField>' +
    '<LoanField>' +
      '<field_id>12</field_id>' + 
      '<field_value>'+opp.Subject_Property_City__c+'</field_value>' +
    '</LoanField>' +
    '<LoanField>' +
      '<field_id>15</field_id>' + 
      '<field_value>'+opp.Subject_Property_Zip__c+'</field_value>' +
    '</LoanField>' +
    '<LoanField>' +
      '<field_id>364</field_id>' + 
      '<field_value>'+opp.Loan_Number__c+'</field_value>' +
    '</LoanField>' +
    '<LoanField>' +
      '<field_id>65</field_id>' + 
      '<field_value>'+opp.Borrower_SSN__c+'</field_value>' +
    '</LoanField>' +
    '<LoanField>' +
      '<field_id>68</field_id>' + 
      '<field_value>'+opp.Co_Borrower_First_Name__c+'</field_value>' +
    '</LoanField>' +
    '<LoanField>' +
      '<field_id>69</field_id>' + 
      '<field_value>'+opp.Co_Borrower_Last_Name__c+'</field_value>' +
    '</LoanField>' +
    '<LoanField>' +
      '<field_id>97</field_id>' + 
      '<field_value>'+opp.Co_Borrower_SSN__c+'</field_value>' +
    '</LoanField>' +
    '<LoanField>' +
      '<field_id>1240</field_id>' + 
      '<field_value>'+opp.Borrower_Email__c+'</field_value>' +
    '</LoanField>' +
  '</LoanData>' +
'</LoanEntries>'
     );

    
     //req.setEndpoint('https://api.XXXYYY.com/eupdate/EUpdateService.svc/getFieldMappings');
     //req.setMethod('GET');
 
     Http http = new Http();
     try{
     HTTPResponse res = http.send(req);
     System.debug(res.getBody());
     String loanID = res.getBody();
     if(loanID.contains('Created')){
     loanID = loanID.split(':', 14)[2];
     loanID = (loanID.split('<',39)[0]).trim();
     system.debug(loanID);
     opp.GUID__c = loanID;
   //  EncompassMSG = 'Encompass loan record is successfully created, Click ok to continue';
     }
     else{
      loanID = loanID.split(':', 14)[2];
      loanID = (loanID.split('<',39)[0]).trim();
      system.debug(loanID);
      opp.GUID__c = 'Error: ' +loanID;
      //EncompassMSG = 'Error is occured while creating Encompass record, please try again or contact support';
     }
    
     update opp;
     if((opp.GUID__c).contains('Error')){
     return 'Error is occured while creating Encompass record, please try again or contact support';
     }else{
     return 'Encompass loan record is successfully created';
     }
   }
   catch(System.CalloutException e){
    return 'Request time is out, Please try again';
   }
   }
}

If I have a static method on an Apex class, can I use it in an Approval Process's entry criteria?

Hi everybody,

I have a problem with updating Opportunity Products. User can change the Discount, the Quantity and the Sales Price (in special cases only). The Total Price shall be calculated by the system and displayed at the VF page. In some cases Discount can be set to 100%. If so, I detected the issue that  the Sales Price (OpportunityLineItem.UnitPrice, so I call it UnitPrice in the following description) is set to null by the system during the Update.

In Forum Threads and in the Documentation of the OpportunityLineItem Object I read that UnitPrice and TotalPrice must not be set both during an Update. That’s why I force the TotalPrice to be null before I update a record which is selected from the database before. Indead, this solves the problem. The UnitPrice is stored into the database as expected and TotalPrice is calculated to 0.0 which is correct. Unfortunately the next update in exactly the same manner is failing. I get an exception that the TotalPrice must not be null…

 

I narrowed down the behavior with a simple test class in a developer edition. There are no custom fields, no triggers and no validation rules for the object OpportunityLineItem.

 

Here is the code of my test class mixed with the corresponding Debug information picked out from Apex Test Runner window in the IDE (Eclipse).

 

    static testMethod void myUnitTest() {
        // insert a dummy Product with PricebookEntries then check that they were created
        Product2 pr1 = new Product2(Name='Unit Test Product PR1 Dummy');
        insert pr1;
 
 	//Get the PriceBook
 	PriceBook2 pb=[Select Name, IsStandard, IsActive, Id From Pricebook2 Where IsStandard=true Limit 1];
 	PricebookEntry pe1 = New PriceBookEntry(Product2Id=pr1.Id,PriceBook2Id=pb.Id,unitPrice=444.0,isactive=true);
 	insert pe1; 
        
     
        Account ac1 = new Account(Name='Unit Test Parent');
        insert ac1;
        
        Opportunity op1 = new Opportunity(Name = 'Unit Test Parent', StageName='Prospecting', 
        CloseDate=System.today().addDays(1), AccountId=ac1.Id);
        insert op1;
        Opportunity op1s = [SELECT ID FROM Opportunity WHERE Id=:op1.Id];
 
        //check calculation Prices
        OpportunityLineItem ol1 = new OpportunityLineItem(OpportunityId=op1.Id, 
            UnitPrice=123.00, Quantity=1,Description=null, Discount=100, PricebookEntryId=pe1.Id);

        System.debug(LoggingLevel.INFO, '**********Before Insert Id=null ListPrice= '
        +ol1.ListPrice+' UnitPrice=' + ol1.UnitPrice+' Discount='+ol1.Discount+' TotalPrice='+ol1.TotalPrice);

 

 

14:17:14.598 (1598203000)|USER_DEBUG|[27]|INFO|**********Before Insert Id=null ListPrice= null UnitPrice=123.00 Discount=100 TotalPrice=null

        insert ol1;

       OpportunityLineItem ol2=[Select  o.UnitPrice, o.TotalPrice,
       o.Quantity, o.PricebookEntryId, o.ListPrice,
       o.Id, o.Discount From OpportunityLineItem o where o.id=:ol1.Id];
        
        System.debug(LoggingLevel.INFO, '**********After Insert Id='+ol2.Id+
        ' ListPrice= '+ol2.ListPrice+' UnitPrice=' + ol2.UnitPrice+
        ' Discount='+ol2.Discount+' TotalPrice='+ol2.TotalPrice);

 

14:17:14.688 (1688622000)|USER_DEBUG|[34]|INFO|**********After Insert Id=00kG000000HBCU9IAP ListPrice= 444.00 UnitPrice=123.00 Discount=100.00 TotalPrice=0.00

 

OKAY

 

 		Update ol2;
 		
 
        OpportunityLineItem  ol3=[Select  o.UnitPrice, o.TotalPrice,
        o.Quantity, o.PricebookEntryId, o.ListPrice, o.Id,
        o.Discount From OpportunityLineItem o where o.id=:ol2.Id];
 
        System.debug(LoggingLevel.INFO, '**********After Update '
        +ol3.Id+'ListPrice= '+ol3.ListPrice+ ' UnitPrice=' 
        + ol3.UnitPrice+' Discount='+ol3.Discount+' TotalPrice='
        +ol3.TotalPrice);

 

14:17:14.739 (1739783000)|USER_DEBUG|[42]|INFO|**********After Update 00kG000000HBCU9IAPListPrice= 444.00 UnitPrice=null Discount=100.00 TotalPrice=0.00

 

Problem: UnitPrice is set to null. Trying to hide this by setting TotalPrice to null:

 

	//Try to set TotalPrice to null  because it's 0.0 after update
 	ol2.TotalPrice=null;
  	Update ol2;
 		
 	ol3=[Select  o.UnitPrice, o.TotalPrice, o.Quantity, 
          o.PricebookEntryId, o.ListPrice,o.Id, o.Discount 
          From OpportunityLineItem o where o.id=:ol2.Id];
        
        System.debug(LoggingLevel.INFO,
        '**********After Update with TotalPrice set to null '
         +ol3.Id+'ListPrice= '+ol3.ListPrice+ ' UnitPrice=' 
         + ol3.UnitPrice+' Discount='+ol3.Discount+' TotalPrice='
         +ol3.TotalPrice);

 

14:17:14.790 (1790286000)|USER_DEBUG|[50]|INFO|**********After Update with TotalPrice set to null 00kG000000HBCU9IAPListPrice= 444.00 UnitPrice=123.00 Discount=100.00 TotalPrice=0.00

 

OKAY! But what if user updates a second time:

 

 	//Try to set TotalPrice to null again because it's 0.0 after update
  	ol2.TotalPrice=null;
  	Update ol2;

	ol3=[Select  o.UnitPrice, o.TotalPrice, o.Quantity, 
          o.PricebookEntryId, o.ListPrice,o.Id, o.Discount 
          From OpportunityLineItem o where o.id=:ol2.Id];
 
         System.debug(LoggingLevel.INFO, 
        '**********After 2. Update with TotalPrice set to null '
        +ol3.Id+'ListPrice= '+ol3.ListPrice+ ' UnitPrice=' 
        + ol3.UnitPrice+' Discount='+ol3.Discount+' TotalPrice='
        +ol3.TotalPrice);
 
    }
}

 

14:17:15.099 (2099067000)|FATAL_ERROR|System.DmlException: Update failed. First exception on row 0 with id 00kG000000HBCU9IAP; first error: FIELD_INTEGRITY_EXCEPTION, field integrity exception: TotalPrice (total price must be specified): [TotalPrice]

 

Why can't I update the same record twice with TotalPrice set to null? Maybe I'm wrong with anything...

 

Any explainings for this behavior? I urgently need an idea how to solve this trouble. Seems to be the same problem in Winter’12 and Spring ’12.

 

Thanks in advance,

Elke

  • February 02, 2012
  • Like
  • 0

Hello,

 

Is there a way to find only those Accounts which have an Activity of a certain type in their ActivityHistory and exclude the ones that don't?

 

My current query looks like this:

 

SELECT Id, Name, ( SELECT Id, ActivityType, ActivityDate, Description, Status, Owner.Id, Owner.Name FROM ActivityHistories WHERE ActivityType = 'my_activity_type' ORDER BY

ActivityDate DESC ) FROM Account



What I want is only Accounts where ActivityHistories is not empty. e.g WHERE AccountHistories != null or so.

 

I know that I could just collect the Ids of the relevant accounts manually and do a second query. But since the number of Accounts in the system is > 40000 I'd rather get it all done in one step.

 

Thank you for your help!

 

Hi All, I've been banging my head against the wall I have a SOQL queery and pull out the information as below into two lists.

 

for(Project_Activity__c p : ProjectActivityList)
        {

            ProjList.add(p);
            for(Time_Sheet__c t : p.Time_Sheets__r)
            {
                TimeSheetList.add(t);
            }
        }

 

So i have projects and then time sheets under that. Does anyone know of a way i can represent this in visual force? any help would be great as im really stuck. I tried the iframe route but i need to be able to edit the time sheets and save them back.

 

Thanks for any help guys.

 

 

  • September 02, 2011
  • Like
  • 0

Hi,

 

I need to find Minimum date and maximum date from list of dates.Can anyone give me solution?

 

Regards

banu

  • September 02, 2011
  • Like
  • 0

  public List<EventItem> FromGoogleToSF(){
        List<EventItem> elist = new List<EventItem>();
        GoogleData.Calendar cal = c.getCalendarByTitle('lele');
            GoogleData evs_rang = c.getFeed(cal.alternate);
            for(Event e:cal.eventFactory(evs_rang)){
                elist.add( new EventItem(e));
            }
        return elist;
    }

In eclipse ,Look  this Error:
Save error: Invalid type: EventItem    google_data_toolkit/src/classes    FromGoogleToSalesForce.cls   

who can tell me "EventItem"???? 


  • August 31, 2011
  • Like
  • 0

Hi all - I'm having trouble writing a test class for the following apex code:

 

trigger LastSWDate on Task (after insert, after update) {
  
  
  //To do - If the subject of a completed task contains "SW", put the date of the completed task in the 
  //the "Last_SW_Activity__c" field on the account object

//Create a set of related account ID's
Set <ID> acctIDs = new Set <ID> ();


//For every task, add it's related to account ID to the set
  for (Task t: Trigger.new){
    acctIDs.add(t.accountID);
//Create a map to match the task related to ID's with their corresponding account ID's
    Map<ID, Account> acctMap = new Map<ID, Account> ([Select ID, Last_SW_Activity__c from Account where ID in :acctIDs]);
//Create the account object
      Account acctRec = acctMap.get(t.accountID);

//If the account ID isn't null, the subject line starts with "sw", and the task has been marked as completed    
  If ((t.accountID != null) &&(t.subject.indexOf('sw')==0) && (t.Status == 'Completed'))
//Check to see if the Last_SW_Activity__c field is current compared with the latest completed activity
      If (acctMap.get(t.accountID).Last_SW_Activity__c < t.LastModifiedDate || acctMap.get(t.accountID).Last_SW_Activity__c ==null){
//Update the Last_SW_Activity__c field on the account object with the task's end date  
        acctrec.Last_SW_Activity__c = t.LastModifiedDate;
        update acctRec;
    }
  }
}

 Can somebody please help take a stab at a test class for this?  I would really appreciate it!  Thanks!

  • August 30, 2011
  • Like
  • 0

My client would like an Opportunity to show Amount of all Products listed on the opportunity (which is currently does). They also would like two Custom Fields (Roll Up i presume) that show Amount - Recurring and Amount - Nonrecurring. 

Amount = $1000

Amount Recurring = $250

Amount Non-recurring =$750

 

I have two Product Families 1. Recurring and 2. Non-recurring so I could use these as filters (if I knew how)

 

Could someone help me determine the best way to accomplish this? I've tried creating two fields using the Roll Up type, but I see no way to filter by Product Family.

 

I need advice.

 

We want to build an account hierarchy of parent accounts and child accounts (no deeper), with a related list on the parent account and the parent account field on the child account pointing back to the parent.  We have done this - so far so good.

 

Next, we need the contacts at the parent account to be able to create cases for the child accounts either thru customer portal or by our support group creating cases for them.  The contacts at the parent accounts need to be able to see, add comments and attachments to these cases at their child accounts.

 

Do we need a sharing rule?  at account or case?  or ???

I am trying to implement the service console and am stuck on a button issue.

 

Currently  I have a custom "New Case" button that displays within a contact.  It uses javascript to auto-pop some fields based on user settings

Ex:

window.parent.location.href ="%2F500%2Fe?00N800000034wTE={!$User.Language_Support__c}&cas3_lkid={!Contact.Id}&00N80000003MDbe={!$User.Default_Country_cases__c}&retURL=%2F500%2Fo";

 

In testing within the console, this will load the case creation form outside the console.  To get around this, I am using the following code (some hard coding in place right now to eliminate variables):

 

{!REQUIRESCRIPT("/soap/ajax/22.0/connection.js")} 
if (typeof(srcUp) == 'function') 
{
} else {    
     window.parent.location.href ="%2F500%2Fe?00N800000034wTE={!$User.Language_Support__c}&cas3_lkid={!Contact.Id}&00N80000003MDbe={!$User.Default_Country_cases__c}&retURL=%2F500%2Fo";
}
Now the behavior is working in console (as well as if not in console), however I believe that because the button originates from a "Contact" page, that somehow the controller class is not changing to a case controller.  Even though the main page is laid out correctly, I am not getting the Knowledge or other side bars that should be there (getting contact one still).
Any suggestions on how to fix this, or a more elegant way of doing this would be appreciated.  The built in "New Case" works fine, but I need to pass some $user parameters into case fields during submission, all while remaining within console.

 

Hello.  I am trying to display a consolidated list of my customer sales on a VF page.  I am wanting summarize the various values of Bookings__c and Profit__c for each customer number (CustNumber__c).

 

I am pretty sure that I am doing the aggregate result computation properly.  However, I am having issues creating the List that would be referenced on the VF page.  Can someone suggest how to set up the getter?

 

Thanks in advance.

 

 

AggregateResult[] AgR = [SELECT CustNumber__c, SUM(Bookings__c), SUM(Profit__c) FROM IndivOrders__c WHERE Customers__r.id=:CustID GROUP BY CustNumber__c ORDER BY CustNumber__c]; 
for (AggregateResult SalesList : AgR) { 
dddd = String.valueOf(SalesList.get('CustNumber__c'));
xxxx = String.valueOf(SalesList.get('expr0'));
yyyy = String.valueOf(SalesList.get('expr1')); 
}

 

 

I am trying to understand standard controllers vs. custom--and how they can be used with Custom Objects?

 

Most of the code samples I have found all use the standard Account or Contact as the example like...

 

<apex:page standardController="Account" showHeader="true"  tabStyle="Account" > 

 

I have several Custom Objects that I have created---and have trying to create a simple Tabbed view of the object detail and related lists instead of the typical list view--using VF.

 

I am just starting on VF...

 

>Do standard controllers get 'auto-created' for each custom object?--assume so and thats how the display using standard SF look?

 

> When I try starting my VF page to be used on my Custom Object with...

 

 

<apex:page standardController="ThenameIusedtocreatetheobject_c" showHeader="true"  tabStyle="ThenameIusedtocreatetheobject_c"" > 

 

 

I get errors - ThenameIusedtocreatetheobject_c Does not Exist, etc.

 

 

What am I missing about standard controllers on custom objects?  Do all custom objects require a custom controller to be coded?

 

Thanks for the assistance...

 

KS

Hi,

 

I enable validation and trigger on lead convert in my org.

 

My code is updating hidden owne field same as account owner,if some is creating new accout or updating account owner field.

 

Now when user ( like x)convert lead to new account,user pick record owner name(like Y) and convert lead with new account.

 

Now this new account have account owner name as Y,but while checking hidden owner field value which is X(based on code it should be Y) which is wrong.

 

Here is my code.

 

trigger changeRSMDirector on Account (before insert,before update) { Map<String, Account> accountMap = new Map<String,Account>(); for(Account a: System.Trigger.new){ if((a.OwnerId!=null)&& (System.Trigger.isInsert || (a.OwnerId != System.Trigger.oldMap.get(a.Id).OwnerId))){ a.Hidden_Owner__c=a.OwnerId; accountMap.put(a.Hidden_Owner__c,a); } } }

with update account and insert new account without lead convert,Trigger works fine.

 

Can some one let me know why this trigger is not working while elad convert.

 

-Thanks