• Vipin Pulinholy
  • NEWBIE
  • 55 Points
  • Member since 2004
  • Salesforce Solution Engineer

  • Chatter
    Feed
  • 2
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 38
    Questions
  • 36
    Replies
I am trying to write a trigger that will update a picklist field on the lead object. So when a lead has an activity added such as a call or email I would like for the lead status picklist to be updated from Not Contacted/New to Contacted. Thank for your help.

Hi, Can you please tell me if the just in time provisoning can be used for cutomer portal users?

Can Just-In-Time Provisioning in Summer '11 be used to add new Customer Portal users?

Hi Friends,

 

I am running following query on Batch Apex:

 

Select Compensation_Bucket_Product__r.Compensation_Bucket_ID__r.Id Comp_Id, 
Reporting_Segment__r.Id RSC_Id,  
SUM(PFYE_Sales__c) PYESales,
SUM(PFYE_GP__c) PYEGP, 
SUM(PFYTD_Sales__c) PYTDSales,
SUM(PFYTD_GP__c) PYTDGP, 
SUM(CYFTD_Sales__c) CYTDSales,
SUM(CFYTD_GP__c) CYTDGP,
SUM(CY_Sales_Run_Rate__c) CYRRSales,
SUM(CY_GP_Run_Rate__c) CYRRGP,
SUM(NY_Sales_Run_Rate__c) NYRRSales,
SUM(NY_GP_Run_Rate__c) NYRRGP,
RecordTypeId 

FROM Compensation_Bucket_Forecast_Items__c 

GROUP BY Compensation_Bucket_Product__r.Compensation_Bucket_ID__r.Id,
Reporting_Segment__r.Id,
RecordTypeId 

HAVING Compensation_Bucket_Product__r.Compensation_Bucket_ID__r.Id <> NULL AND Reporting_Segment__r.Id <> NULL AND RecordTypeId =\''+salesRecId.Id+'\''; 

 

This query runs well in VFcontroler/Eclipse. But if I run on batch Apex I get follwoing Error:

 

First error: Field must be grouped or aggregated: Id
 
Could you please help us on fixing this issue.? Where we went worng?
Thanks much for your time.

Hi All,

 

I have a requirement to show # of open Task on Lead Detailpage. Below is the logic that we are planning to implement. I would like tocheck with you if any one has implemented similar functionality handling BULK insert/update.If so could you please share the code?

 

Trigger on Task <after insert after update>

 

{

    for (Task thistask : Trigger.new)

      {

    // Get all leads assosited to Tasks

    if (WhoId.startsWith('00Q'))               

      leadIdToUpdateList.add(taskWhoId.WhoId);

     }

 

FOR each Lead

           SelectCount() from Task where whoId=LeadId and Status=Completed

           Updatecustom field “ Open Task” on  Lead object

End Loop   

 

}

 

Thank You . 

Hi,

 

I want to Display # of Open Task on a custom field on Account & Opportunity.  Is there a way to display this ( Count (open Task) on Account/Opportunity)) with out using Trigger?

 

Could you please share your thoughts?

 

Thanks. 

 

Hi,

 

I need to get all Role Name which don't have any users assosciated with it.

 

SOQL like this: 

Select u.Name, (Select Id From Users) from UserRole u where Id !=null

 

This is not working. Can any one tell me correct soql for this.

 

Thanks

Hi,

 

I have this trigger on task.

 

 

trigger PIMAccountOwnerUpdate on Task (before update,before insert) { for (Task h : Trigger.new){ Opportunity [] opid= [Select o.OwnerId,o.Owner.Alias from Opportunity o where id=:h.WhatId ]; Contact [] contid = [Select c.OwnerId, c.Owner.Alias from Contact c where id=:h.WhoId ]; if (opid .size()> 0) h.PIM_Account_Owner__c = opid[0].Owner.Alias ; else h.PIM_Account_Owner__c = '' ; if (contid .size() > 0) h.Contact_Owner_Alias__c = contid [0].Owner.Alias ; else h.Contact_Owner_Alias__c = '' ; } }

And following Test Class.

 

@istest private class PIMAccountOwnerUpdate { static testMethod void passTest() { test.starttest(); Date futureDate = date.newInstance(2010, 6, 6); Account account = new Account(name='testAccount'); insert account; account = [select name from Account where name=:account.name]; Opportunity opp = new Opportunity(name='testOpp', accountID=account.ID, StageName='Prospect 3', CloseDate = futureDate); insert opp; opp = [select ID, name from Opportunity where ID=:opp.ID]; Contact contact = new Contact(lastname='testContact', accountID=account.ID); insert contact; contact = [select name from Contact where LastName=:contact.lastname]; Task h = new Task ( OwnerId='005300000017Z6B', Status='In Progress',Subject='Compile a Mailing',WhatId=opp.Id ); try { insert h; System.assert(true); System.debug('Updated '); } catch (DmlException e) { System.debug('Query Issue: ' + e); } Task h1 = new Task ( OwnerId='005300000017Z6B', Status='In Progress',Subject='Compile a Mailing',WhoId=contact.Id ); try { insert h1; System.assert(true); System.debug('Updated1 '); } catch (DmlException e) { System.debug('Query Issue: ' + e); } Opportunity [] opid= [Select o.OwnerId,o.Owner.Alias from Opportunity o where id=:opp.Id ]; Contact [] contid = [Select c.OwnerId, c.Owner.Alias from Contact c where id='00330000002kPEq' ]; if (opid.size() > 0) { System.debug( 'Inside For Loop'); } test.stoptest(); } }

This is what the trigger does:

I have two custom fields created on Task (Activity) object (PIM_Account_Owner & Contact_Owner_Alias). When ever user update/creates any task I wanted to update these custom fields (PIMM_Account_Owner & Contact_Owner_Alias) with the value of Opportunity Owner Alias and Contact Owner Alias respectively.

 

When I run test on this test class I get 100% converge. 

But when I try to deploy this trigger Production I get 0% coverage results.

Deployment Result

Deployment Result 

I have this owner id (005300000017Z6B) present in the Sandbox and Prod.

 I am using Eclipse Force IDE. 

Could any one please help me on this?

 

 
Message Edited by das on 09-16-2009 10:58 AM

I have this code in my VF page

<apex:outputLink onclick="window.open('/apex/myLastActivity?id={!m.Id}','LastActivity','width=610,height=170,toolbar=0,status=1,scrollbars=1,resizable=yes')" >{!n.Subject}</apex:outputLink>

 

When I click this 'Subject' link a new popup winodw should open. It works perfectly in Firefox. But in IE after I click this link it opens the new window and after that the main page (parent page) automatically refreshes to the following link:

 

https://c.cs3.visual.force.com/apex/

 

 And I get the "URL No Longer Exists
You have attempted to reach a URL that no longer exists on salesforce.com..... " Message.

 

Do any body know how to fix this issue?

 

Hi,

 

I have this code:

 

var soql= SELECT c.Account.Name (SELECT Subject,ActivityDate, Description from ActivityHistories) FROM Contact c WHERE Name Like 'XYZ%' var sql = sforce.connection.query(soql); var records = sql.getArray("records"); for (var a in records) { returnArray[a] = new Array(); alert(records[a].Name); //alert(records[a].ActivityHistories.Subject); .... .... }

I get Contact Name from  records[a].Name. I am not sure how to get the values of ActivityHistories object.

I wanted to get the values of  Subject,ActivityDate, Description and display it to the page.

Could you please help me ? how can we reference this Relatiohip query result?

Thanks for Your Time.

Hi,

 

I have this query in my apex class:

actvty= [ SELECT (SELECT ActivityDate, Description,Subject,who.name from ActivityHistories order by ActivityDate desc ) FROM Contact WHERE Id in :contid]; return actvty;

I am not sure how do I display this result in Visual force page. I tried the follwing but give me error.(Error: Invalid field Subject for SObject Contact)

<apex:pageBlockTable value="{!actvty}" var="t" rendered="{!NOT(ISNULL(actvty))}" > <apex:column value="{!t.Subject}"/> <apex:column value="{!t.Who.Name}"/> <apex:column value="{!t.ActivityDate}"/> </apex:pageBlockTable> <apex:outputLabel value="No records to display" rendered="{!(ISNULL(actvty))}" styleClass="noRowsHeader"></apex:outputLabel> </apex:pageblock>

 

Could you please help me ?

 

Message Edited by das on 08-03-2009 04:11 PM
Message Edited by das on 08-05-2009 03:47 PM

Hi All,

 

Im beginning to learn Apex, so bare with me! ive been faced with a curly one to start me off with learning Apex and i am a little stuck already. Here is the situation:

 

* 2 objects involved - Customer Satisfaction Index (will call it CSI here on in) and Tasks.

* On the CSI object, there are a number of Tasks that need to be completed by the Account Owner. These tasks are created via workflow from the CSI Object and are therefore Tasks

* What i require is a COUNT of all the Tasks that have the status as "Completed" relating to that CSI to be displayed in the field Completed_Tasks_c on the CSI object.

 

Im having trouble with the COUNT part of it displaying in the Completed Tasks field.

 

Any help? Thanking you all in advance.

 

Cheers

 

Hello Friends,

 

I am facing a strange issue with opening attachments from a custom VF screen in IE.

 

It's working fine in Mozilla(Firefox) but giving me nightmares in IE :(

 

Code is pasted below:

 

<apex:outputLink onclick="window.open('https://cs2.salesforce.com/servlet/servlet.FileDownload?file={!act.CostAttachmentId}','Attachments');" rendered="{!IF(act.CostAttachmentId <> null,true,false)}"> View</apex:outputLink>

 

Its running fine in Mozilla(FireFox) but somehow, in IE the link of the main VF page gets broken when this new window is opened.

 

I have no clue as to why is this happening :(

 

Can anyone please help me out??

 

Thanks,

Cool_D

Hi all,

 

I have created an Approval Process on Case object and i have select Approver option manully.

 

I have one trigger that trigger the Approval process but i am unable to findout any Option or Method for assigning Approver for Approval process.

 

Please let me know if any one has any idea?

  

 

-- Deepak