• jyovas
  • NEWBIE
  • 5 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 9
    Replies

I have two objects Portfolio__c with a formula filed  Index__r.Chg_Pct__c and a child object position(s) with a field

Daily_Perf__c

 

I want the SUM(Daily_Perf__c ) from positions while selecting each portfolio object

 

when I executed the following query


select  Index__r.Chg_Pct__c  , (select SUM(Daily_Perf__c) from positions__r)  from Portfolio__c

 

I get the error "Only root querires support aggregate expressions"

 

If  I go from child and use Group BY

 

 

select SUM(Daily_Perf__c) dailypref, Portfolio__r.Index__r.Chg_Pct__c  from position__c
group by  Portfolio__r.Index__r.Chg_Pct__c

 

I get the error "field Chg_Pct__c cannot be grouped in a query call . Is it becuase its a formulat filed ?

 

How do I  do SOQL simillar to Rollup summary Filed in salesforce ?

 

Thanks,

-John

I know an object  can have more than one External Id fields.I my case I have two external Id columns. While resolving the keys in child object, Is there any way we can use two External Ids in upsert

 

 Match on External Id1  If match not find Match on External Id2 if no match Insert ....

 

Can we do this while using dataloader ?

 

Thanks.

-John

From a Event record how to differentiate if the entry belong to a public calendar or personal calendar ? I have a requirement to add any Activities added to a custom object to a public  calendar. How do I achive this ?

 

TIA

-John

  • April 21, 2011
  • Like
  • 0

I have a Apex Scheduler class which will send out emails on nightly basis to designated compliance SMTP mail box.I want to set the "From" address of the email to be the user who created the record .I have the userId and can query the User objct and set the display name but not sure how to set the from address.

 

Is it possible?

 

Thanks for the help

-John

  • April 04, 2011
  • Like
  • 0

I am  trying to use DataLoader to upload records using UPSERT operation and my CSV file has 400,000 records .uploading into Custom object . What is the typical configration I should have in config.properties ?

Currently I have

sfdc.useBulkApi=true

sfdc.loadBatchSize=2000

sfdc.bulkApiSerialMode=true

 

and I have changed the heap size in process.bat as

..\_jvm\bin\java.exe -Xms1024M -Xmx1024M

 

But after 20,000 records I get below exception . Any help will be appreciated .

 

Thanks,

-John


        at com.sforce.async.RestConnection.createBatchFromStreamImpl(RestConnect
ion.java:153)
        at com.sforce.async.RestConnection.createBatchFromStream(RestConnection.
java:125)
        at com.salesforce.dataloader.action.visitor.BulkLoadVisitor.createBatch(
BulkLoadVisitor.java:267)
        at com.salesforce.dataloader.action.visitor.BulkLoadVisitor.doOneBatch(B
ulkLoadVisitor.java:147)
        at com.salesforce.dataloader.action.visitor.BulkLoadVisitor.createBatche
s(BulkLoadVisitor.java:129)
        at com.salesforce.dataloader.action.visitor.BulkLoadVisitor.loadBatch(Bu
lkLoadVisitor.java:90)
        ... 7 more
Caused by: com.sforce.ws.ConnectionException: unable to find end tag at:  START_
TAG seen ..."http://www.force.com/2009/06/asyncapi/dataload">\n <exceptionCode>.
.. @3:17
        at com.sforce.ws.bind.TypeMapper.consumeEndTag(TypeMapper.java:399)
        at com.sforce.async.BatchInfo.load(BatchInfo.java:284)
        at com.sforce.async.BatchRequest.loadBatchInfo(BatchRequest.java:77)
        at com.sforce.async.RestConnection.createBatchFromStreamImpl(RestConnect
ion.java:147)
        ... 12 more
2010-12-21 16:06:06,930 ERROR [main] progress.NihilistProgressAdapter doneError
(NihilistProgressAdapter.java:56) - Failed to create batch

  • December 22, 2010
  • Like
  • 0

We have a requirement to hide task for certain ProfileTypes(Retail) . Retail Profile users can see the accounts but not the tasks created by different profile type users.

 

We have created a private flag in Task and planning to deny the task details with a VF page based on this flag.so this means they can see it in the related list and not in details of the task. But there is a problem with this solution if the retail users create a report the task details are visible not sure how to hide from report.

 

Any idea how to implement this ?

 

Thanks in advance

-John

  • October 28, 2010
  • Like
  • 0

What is the best way to filter data in related list? I want to filter records in Contact related list in Account page with certain recod types.

 

The requirement is when certain type of user is logged in he should see the contact records of a specific recordtype in account page contact related list.

 

Thanks in advance

-John

  • September 08, 2010
  • Like
  • 0

hi I have a custom page for Opportunity and have two fileds Type and Portfolio of type PickList. As this list can grow from populated records I want to populate this picklist from table values . I am able to achive that and able to save the record But when I edit the saved record all other fields are populated except the Picklist fields. How does Salesforce store picklist in actual record as Text or ID ?

 

page

 

 <apex:actionRegion > 
          <apex:selectList value="{!typeExt}" size="1" id="typeList">
            <apex:selectOptions value="{!TypeOptions}"/>
            <apex:actionSupport event="onchange" rerender="portfolioList" />
           </apex:selectList>
       </apex:actionRegion> 

 <apex:PageBlockSectionItem >

 

 <apex:outputLabel value="Portfolio" />
        <apex:selectList size="1" id="portfolioList" value="{!portFolio}">
        <apex:selectOptions value="{!PortfolioOptions }"/>
        </apex:selectList>
       </apex:PageBlockSectionItem>

 

Controller

public List<selectOption> PortfolioOptions {

get {
        List<selectOption> types =new List<selectOption>();
        types.add(new SelectOption('','- None -'));
        if(typeExt != NULL ) {
                OpportunityType__c opType = [select OpportunityVehicle__c from OpportunityType__c  where id = :typeExt ];
             for (Portfolio__c port : [select Name from Portfolio__c where OpportunityVehicle__c= :opType.OpportunityVehicle__c]){
              types.add(new SelectOption(port.id, port.Name ));
              }
          }
          else{
            for (Contact c : [select lastname from contact c where lastname ='Jobs' ]){
              types.add(new SelectOption(c.id,c.lastname ));
              }
          }
                 return types;
 }        

private set;
}

public List<selectOption> TypeOptions {
get {       
    List<selectOption> types =new List<selectOption>();
    types.add(new SelectOption('','- None -')); 
    for( OpportunityType__c opt: [select Id, Name,OpportunityVehicle__c from OpportunityType__c])
   {
      types.add(new SelectOption(opt.Id ,opt.Name));
   }   
     return types;
 }
 private  set;
 }

 

What do i have to do to retain the saved values in Edit page ?

 

BTW I am saivng the picklist value as TEXT  . Is it right ?

 

public void SetportFolio(string s){
    this.portFolio =s;
    Portfolio__c port = [select Name from Portfolio__c where id =:this.portFolio];
    this.oppor.Portfolio__c = port.Name;
}

Thanks,

John

  • September 03, 2010
  • Like
  • 0

I am new to Visaulforce pages. I have a requirement to cuztomize Call Log page, to remove the followup section and the Stauts picklist value should have a "Completed" value. I tried removing followup=1 parameter from URL that takes away the Follow up section but I am not sure how to set the picklist value when the page is rendered. Should I write my own controller and set the value there  in constructor or is there any easy way to set the value in page load event?

 

Thansk in advance

Hi,

 

I have a date field mandatory in a custom object, when writting the test method i get an error:



 

 Compile Error: Invalid initial expression type for field Start_Date__c

Error: Compile Error: Invalid initial expression type for field Start_Date__c, expecting: Date at line 14 column 44

 

 

How do I have to set the date??

 

I have tried:

dd/mm/yyyy

dd/mm/yy

ddmmyy

'Today'

 

Thank you!

I am trying to insert a bunch of tasks programicly. Everytime i try to insert more then one I get an error. Can anyone Explain what the error means and what I am doing wrong? It would really help thanks.

 

Apex for Inserting:

 

trigger Account_Task_Trigger on Account (before insert, before update) {
	
	List<Account> newAccount = trigger.new;
	List<Contact> contactList = [SELECT Name, Id, AccountId, Title FROM Contact WHERE Title LIKE '%Director%' OR Title LIKE '%Manager%'];
	List<Contact> contacts = new List<Contact>();
	Task newTask = new Task();
	List<Task> taskList = new List<Task>();
	
	for(Account A : newAccount){
	    if(A.TAP__c == 'Reviewed - TAP'){
	    	for(Contact C : contactList){
	    		if(A.Id == C.AccountId) {
	    			contacts.add(C);
	    		}
	    	}
	    }
	}
	
	for(Contact c : contacts){
		newTask.Type = 'TAP';
	    newTask.Subject = 'Call';
	    newTask.Priority = 'Normal';
	    newTask.Status = 'Not Started';
	    newTask.WhoId = c.Id;
	    newTask.WhatId = c.AccountId;
	    taskList.add(newTask);
	}
	
	for(Task T : taskList){
		insert T;
	}

}

 

Error I get:

 

 

Force.com Sandbox: Developer script exception from Solving IT : Account_Task_Trigger : Account_Task_Trigger: execution of BeforeUpdate caused by: System.DmlException: Insert failed. First exception on row 0 with id 00TQ0000008pucSMAQ; first error: INVALID_FIELD_FOR_INSERT_UPDATE, cannot specify Id in an insert call: [Id] Trigger.Account_Task_Trigger: line 30, column 3

From a Event record how to differentiate if the entry belong to a public calendar or personal calendar ? I have a requirement to add any Activities added to a custom object to a public  calendar. How do I achive this ?

 

TIA

-John

  • April 21, 2011
  • Like
  • 0

What is the best way to filter data in related list? I want to filter records in Contact related list in Account page with certain recod types.

 

The requirement is when certain type of user is logged in he should see the contact records of a specific recordtype in account page contact related list.

 

Thanks in advance

-John

  • September 08, 2010
  • Like
  • 0

I am new to Visaulforce pages. I have a requirement to cuztomize Call Log page, to remove the followup section and the Stauts picklist value should have a "Completed" value. I tried removing followup=1 parameter from URL that takes away the Follow up section but I am not sure how to set the picklist value when the page is rendered. Should I write my own controller and set the value there  in constructor or is there any easy way to set the value in page load event?

 

Thansk in advance