• lopezc
  • NEWBIE
  • 175 Points
  • Member since 2008

  • Chatter
    Feed
  • 7
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 123
    Questions
  • 154
    Replies

Hi

My org has an active lead assignment rule, a user can choose to assign an existing lead using said active assignment rule by editing the lead. 

If that is the case the lead is assigned accordingly following the assignment rule otherwise we have another logic in place to assign users using round robin.

 

Now, I don't know how to check in the after insert/update lead triggers if the user ticked  "Assign using active assignment rule" checkbox. 

At the moment, regardless the user ticks that checkbox or not, we always assign using round robin, however this is not what the user wants.

 

Please help!

  • October 18, 2012
  • Like
  • 0

Hi ,

I am trying to approve a custom object by email.

 

I am getting the notification in my email id. I reply back saying "YES" in the first line and send . Immediately i get a reply:

 

"An error occurred and your workflow approval message was not processed. Please contact your system administrator."

 

I replied with the same email address so not sure what is the problem. Please help . This is urgent. Thanks.

  • December 10, 2010
  • Like
  • 0

Hi 

 

I am using radio buttons in my VF page. I noticed that you can change the selection, but not deselect any from being chosen. Is this unavoidable?

HI,

 

I have a visualforce page embedded in a detail page, after pressing a button within my VF page, the oncomplete need to redirect the parent page, I am using JavaScript for this:  

 

 

<script language="JavaScript">

function openUserStoryView(workid){    
	parent.location.href = '{!URLFOR($Action.ADM_Work__c.View,workid)}';
}
 </script>

..................

<apex:commandButton value="Create Story" action="{!createStory}" oncomplete="openUserStoryView('{!recordCreatedId}')"/>

 The error appears when I reload the page, the visualforce page embedded shows:

 

Content cannot be displayed: Invalid parameter for function URLFOR


Any ideas why?

 

 

Hi, 

 

Using Salesforce.schema within eclipse I have created the below SOQL that returns one row:

 

Select (Select IB_Master_Account__c, IB_Prospect__c From IB_Info__r), (Select IB_Account__c, Prospect__c From Content__r), (Select IB_Master_Account__c, IB_Prospect__c From Commerical_Terms__r) From Lead l where id = '00QS0000004Snxg'

 

 

I tried to add the same SOQL to my apex class but when I try to save it in the server it gives me the following error:

 

 

List<Lead> listL = [Select (Select IB_Master_Account__c, IB_Prospect__c From IB_Info__r), (Select IB_Account__c, Prospect__c From Content__r), (Select IB_Master_Account__c, IB_Prospect__c From Commerical_Terms__r) From Lead l where id = '00QS0000004Snxg'];

Didn't understand relationship 'Content__r' in FROM part of query call.

 

 

 

Why is it not working within using apex but it works using either Execute Anonymous or the Salesforce.schema tool?

 

 

Hi,

 

 

I'm trying to create an update  function for a custom object. In my Visualforce code, there's a commandLink to perform the work. When pressing the link I call a method in my controller that updated the record which ID is passed as a parameter. However, it doesn't work and I get the following error:

 

 

 


System.LimitException: DML currently not allowed

 

 

Class.MyRequestsController.approveRequest: line 135, column 3 External entry point

 

here is part of my code:

 

 

<apex:pageBlockTable value="{!currentQueryBatch}" var="query" columns="7" styleClass="query-table">
		            <apex:column headerValue="Request Number"><a href="requestTicket/RequestDetailsView?id={!query.id}"><apex:outputText value="{!query.Name}"/></a></apex:column>
		            <apex:column headerValue="Subject" value="{!query.Subject__c}"/>
		            <apex:column headerValue="Status" value="{!query.Status__c}"/>
		            <apex:column headerValue="Team" value="{!query.Team_Name__c}"/>
		            <apex:column headerValue="Date" value="{!query.CreatedDate}"/>
		            <apex:column headerValue="OwnerId" value="{!query.OwnerId}"/>
		            <apex:column headerValue="Approval Status" value="{!query.Approval_Status__c}" rendered="{!OR(openQueriesDisplayed,closedQueriesDisplayed)}"/>
		            <apex:column rendered="{!approvalQueriesDisplayed}">
                		<apex:facet name="header">Action</apex:facet>
                        	<apex:commandLink value=" Approve " action="{!approveRequest}">
                        	<apex:param name="queryId" assignTo="{!queryId}" value="{!query.Id}" />
                        	</apex:commandLink>
            	            </apex:column>
</apex:pageBlockTable>

 please, help

 

<apex:pageblock id="openqueries">
<apex:pageBlockTable value="{!currentQueryBatch}" var="query" columns="7" styleClass="query-table">
           <apex:column headerValue="Request Number"><a href="requestTicket/RequestDetailsView?id={!query.id}"><apex:outputText value="{!query.Name}"/></a></apex:column>
           <apex:column headerValue="Subject" value="{!query.Subject__c}"/>
           <apex:column headerValue="Status" value="{!query.Status__c}"/>
           <apex:column headerValue="Team" value="{!query.Team_Name__c}"/>
           <apex:column headerValue="Date" value="{!query.CreatedDate}"/>
           <apex:column headerValue="OwnerId" value="{!query.OwnerId}"/>
           <apex:column headerValue="Approval Status" value="{!query.Approval_Status__c}" rendered="{!OR(openQueriesDisplayed,closedQueriesDisplayed)}"/>
           <apex:column rendered="{!approvalQueriesDisplayed}">
                 <apex:facet name="header">Action</apex:facet>
                         <apex:commandLink value=" Approve " action="{!approveRequest}">
                         <apex:param name="queryId" assignTo="{!queryId}" value="{!query.Id}" />
                         </apex:commandLink>
                         <apex:commandLink value=" Reject " action="{!rejectRequest}">
                         <apex:param name="queryId" assignTo="{!queryId}" value="{!query.Id}" />
                         </apex:commandLink>
               </apex:column>
</apex:pageBlockTable>
</apex:pageblock>

 

Hi,

 

I need to pass an ID to the action executed when pressing the commandButton, I have done how it is shown in the code beloq but it is not working. The action is called but the parameter is not set so I dont have access to the ID within the controller. Any ideas why?

 

 

<apex:component controller="MyRequestsController">
<apex:attribute name="windowsLogin" description="windows user name" type="String" required="required" assignTo="{!alias}"/>
<apex:attribute name="contactId" description="contact Id" type="ID" required="required" assignTo="{!contactId}"/>
	<apex:form >
		<h2>Previous Requests</h2>		
		<apex:pageblock id="openqueries">
		<apex:pageBlockTable value="{!currentQueryBatch}" var="query" columns="7" styleClass="query-table">
		             <apex:column headerValue="Request Number"><a href="requestTicket/RequestDetailsView?id={!query.id}"><apex:outputText value="{!query.Name}"/></a></apex:column>
		            <apex:column headerValue="Subject" value="{!query.Subject__c}"/>
		            <apex:column headerValue="Status" value="{!query.Status__c}"/>
		            <apex:column headerValue="Team" value="{!query.Team_Name__c}"/>
		            <apex:column headerValue="Date" value="{!query.CreatedDate}"/>
		            <apex:column headerValue="OwnerId" value="{!query.OwnerId}"/>
		            <apex:column headerValue="Approval Status" value="{!query.Approval_Status__c}" rendered="{!OR(openQueriesDisplayed,closedQueriesDisplayed)}"/>
		            <apex:column rendered="{!approvalQueriesDisplayed}">
                		<apex:facet name="header">Action</apex:facet>
                        	<apex:commandButton value=" Approve " action="{!approveRequest}">
                        	<apex:param name="queryId" assignTo="{!queryId}" value="{!query.Id}" />
                        	</apex:commandButton>
                        	<apex:commandButton value=" Reject " action="{!rejectRequest}">
                        	<apex:param name="queryId" assignTo="{!queryId}" value="{!query.Id}" />
                        	</apex:commandButton>
            	   </apex:column>
		</apex:pageBlockTable>
		</apex:pageblock>
	</apex:form>
</apex:component>

 

 

 

HI,

 

I want to display the stop text when the AJAX request completes but it is showing when loading the page (even before pressing the button). I can't see why, any ideas?

 

 

<apex:page showheader="false" controller="RequestDetailsViewController" standardStylesheets="false">
<apex:form >
<apex:pageBlock >
    <apex:pageBlockSection title="Request Details">
            <pre><span>{!description}</span></pre>
    </apex:pageBlockSection>
    <apex:pageBlockSection >
    <apex:outputPanel styleclass="button">
           <apex:actionStatus id="process1" startText="(processing..)" stoptext="done"/>
           <apex:commandButton value=" Approve " action="{!approveRequest}" status="process1"/>
           <apex:actionStatus id="process2" startText="(processing..)"/>
           <apex:commandButton value=" Reject " action="{!rejectRequest}" status="process2"/>
    </apex:outputPanel>
    </apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

 

 

 



Hi,

 

I am query the data base to get the SUM(Amount__c), the table has 6 records with amounts 100 and 10. How Can it be possible that the SUM gives me 74.0?

 

Here is the the data saved in the LedgerTransaction__c  table:

 

 

 [SELECT Amount__c

FROM  LedgerTransaction__c where

and Transaction_Type__c = 'Cash In'

and Ledger_Summary__c = 'a1220000000LPDJAA4'];

 

 

Result:

 

(LedgerTransaction__c:{Id=a0PS0000000zGrMMAU, Amount__c=100.00}, LedgerTransaction__c:{Id=a0PS0000000zJ49MAE, Amount__c=10.00}, LedgerTransaction__c:{Id=a0PS0000000zJ4EMAU, Amount__c=10.00}, LedgerTransaction__c:{Id=a0PS0000000zJ4OMAU, Amount__c=10.00}, LedgerTransaction__c:{Id=a0PS0000000zJ4TMAU, Amount__c=10.00}, LedgerTransaction__c:{Id=a0PS0000000zJ7cMAE, Amount__c=10.00})

 

 

 

AggregateResult[] ec= [SELECT SUM(Amount__c),COUNT(Id) FROM  LedgerTransaction__c where Amount__c > 0
and Transaction_Type__c = 'Cash In'
and Days_Since_Transaction__c <= 60
and Ledger_Summary__c = 'a1220000000LPDJAA4' 
GROUP BY Ledger_Summary__c];
System.debug(ec);

 

 [SELECT SUM(Amount__c),COUNT(Id)

                                         FROM  LedgerTransaction__c                                   

                                         and Transaction_Type__c = 'Cash In'

                                         and Ledger_Summary__c = 'a1220000000LPDJAA4' 

                                        GROUP BY Ledger_Summary__c];

 

Result: (AggregateResult:{expr0=74.0, expr1=6})

 

 

Any Ideas?

  • April 22, 2010
  • Like
  • 0

Is it possible to do something like:

 

Select Id from Contact where TODAY - Activated_Date_c >= 5

 

I am getting the error unexpected char '-'

  • April 21, 2010
  • Like
  • 0

Hi

 

I would like to retrieve information from the parent of the Account linked to a contact. The query is based on the object Contacts, is it possible to do it?

 

Something like:

 

Select Account.ParentId.FieldName__c from Contact 

  • April 21, 2010
  • Like
  • 0

Hi,

 

I only have the name of the scontrol and it is used somewhere in Salesforce but I am not sure where... is there a way to know?

 

Please help!

 

Thanks

  • April 16, 2010
  • Like
  • 0

Hi, 

 

I dont see the datepicker in the page, Am I missing something? javascript? Css?

 

My Component:

 

<apex:component controller="HRFormController">
<apex:panelGrid columns="2" cellpadding="0" cellspacing="0">

<apex:outputLabel value="FirstName:" for="firstname"/>	
<apex:inputText id="firstname" value="{!ControllerCase.HEAT_Firstaname__c}" styleclass="text"/>

<apex:outputLabel value="Surname:" for="surname"/>	
<apex:inputText id="surname" value="{!ControllerCase.HEAT_Surname__c}" styleclass="text"/>

<apex:outputLabel value="Start Date" for="joinerStartDate"/> <apex:inputField id="joinerStartDate" value="{!ControllerCase.HEAT_Start_Date__c}"/> 
<apex:outputLabel value="Start Date" for="joinerStartDate"/>
<apex:inputField id="joinerStartDate" value="{!ControllerCase.HEAT_Start_Date__c}"/> 

</apex:panelGrid>
</apex:component>

 

 

  • April 07, 2010
  • Like
  • 0

Hi,

 

I have implemented a Scheduled job that run everyday at 6am. The apex class retrieves a few clients that match a given criteria and calls a @future method to send an email out to each of those clients. Inside the @future method the email is sent doing a call out to a third party. We do individual call outs for each client. The first call out works for the first client but the second and the rest return the following error:

 

System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out

 

Does it mean that we can't do consecutive call outs within the same @future methods?

 

 

global void execute(SchedulableContext sc){
  TradeSenseEmailSender.sendTradeSenseEmail(mapOfIds);	
}

@future(Callout=true)
public static void sendTradeSenseEmail(Map<ID,ID> mapOfIds){ 
    ......
    for each clientFound{
           Http http = new Http();
 	   HttpRequest req = new HttpRequest();	  
           //Add the xml message headers               
           Map<string, string> headers = new Map<string, string>();      
           headers.put('content-length', '0');
           headers.put('Content-type','application/x-www-form-urlencoded; charset=UTF-8');
           req.setHeader('content-length', headers.get('content-length'));
           req.setHeader('Content-type', headers.get('Content-type'));
           req.setTimeout(60000);             
           req.setEndpoint(endpoint);
           req.setMethod('POST');
           req.setBody(EncodingUtil.urlEncode(xml,'UTF-8'));        
           //send the request    
           try{
              HttpResponse res = http.send(req);    
           }catch{
              System.debug(ex.getMessage());
           }  	        
    }
}

 

 

  • April 06, 2010
  • Like
  • 0

Hi,

 

I have a component. It is a form with 2 fields. I don't know a priori which field will be rendered. I have a method in my controller that tells if the field should be displayed or not, the name of the field has to be passed:

 

 

 

 public Boolean displayField(String fieldName){

     if(fieldName!=null){

     for(String field : fields){

     if(fieldName.compareTo(field)==0){

     return true;

     }

     }

     }

     return false;

    }

 

 

  And within my component I want to be able to call the method from the rendered attribute:

 

<apex:outputPanel rendered="">

<apex:outputLabel value="First Name:" for="firstName"/>

<apex:inputText id="firstName" value="{!ControllerCase.HEAT_First_Name__c}" styleclass="text"/>

</apex:outputPanel>

 

<apex:outputPanel rendered="">  

<apex:outputLabel value="Surname:" for="surname"/>

<apex:inputText id="surname" value="{!ControllerCase.HEAT_Surname__c}" styleclass="text"/>

</apex:outputPanel>

 Is there a way to do so?

 
Message Edited by lopezc on 04-01-2010 03:10 AM
  • April 01, 2010
  • Like
  • 0

Can I have SalesforceComponent class in a separate file? At the moment it only works if I put them together:

 

 

public without sharing class Components {

public interface Component {

String getDescription(Case caseN);

String getComponentName();

}

public class SalesforceComponent implements Component{

public String getDescription(Case caseN){

String template = '';

template += 'Desk move:' + (String)((caseN.HEAT_Desk_Move__c)? 'Yes' : 'No') + '\n';

template += 'Report/Dashboards:' + caseN.HEAT_Salesforce_ReportDasboards__c + '\n';

if(caseN.HEAT_Salesforce_ReportDasboards__c){

template += 'Changes Required:' + caseN.HEAT_Salesforce_ReportDashboar_Changes__c + '\n';

template += 'Link to Existing Report:' + caseN.HEAT_Salesforce_ReportDashboar_Link__c + '\n';

}

template += 'New User:' + (String)((caseN.HEAT_Salesforce_New_User__c)? 'Yes' : 'No') + '\n';

if(caseN.HEAT_Salesforce_New_User__c){

template += 'New User Username:' + caseN.HEAT_Salesforce_New_User_Username__c + '\n';

template += 'New User Email Address:' + caseN.HEAT_Salesforce_New_User_Email__c + '\n';

template += 'New User Team:' + caseN.HEAT_Salesforce_New_User_Team__c + '\n';

}

template += 'Demo Conversion:' + (String)((caseN.HEAT_Salesforce_Demo_Conversion__c)? 'Yes' : 'No') + '\n';

template += 'Webinar:' + (String)((caseN.HEAT_Salesforce_Webinar__c)? 'Yes' : 'No') + '\n';

template += 'Other Area:' + caseN.HEAT_Salesforce_Areas__c + '\n';

template += 'More Details:' + caseN.HEAT_Salesforce_More_Details__c + '\n';

return template;

}

public String getComponentName(){

return 'Salesforce';

}

}

} 

 

 

Message Edited by lopezc on 03-18-2010 05:05 AM
  • March 18, 2010
  • Like
  • 0

Hi,

 

I was wondering if it is possible to pass parameters to our controller method while in a VF page.

I want to render a component only if the method called returns 'true':

 <c:NetworkForm case="{!case}" contact="{!contact}" rendered="{!DisplaySection}">

<apex:param name="sectionName" value="NetworkForm" />   

</c:NetworkForm>

And the method is the following:

 public Boolean getDisplaySection(){

String sectionName = apexpages.currentpage().getparameters().get('sectionName');

System.debug('SECTION NAME::::::::::' + sectionName);  //sectionName is null !!!!

if(listOfCategorySections.size() > 0 && callCategory!=null && sectionName!=null){

List<RF_Section_Map__c> sections = listOfCategorySections.get(calltype+callCategory);

for(RF_Section_Map__c loopSec : sections){

if(sectionName.equalsIgnoreCase(loopSec.Component_Name__c)){

return true;

}

}

}

return false;

}

But the parameter is null in my controller, any ideas?

 

Thanks in advance.

  • March 05, 2010
  • Like
  • 0

Hi,

 

2 users are upserting the same record so they get the LOCK error. The first user locks the error just before the second user (From a @future call) tries to update the same record. Is there a work around? is there a way that the second user can retry when the record is unlocked? You can't make a @future call from a @future call.

  • February 18, 2010
  • Like
  • 0

Hi,

 

I need to pass a parameter to my controller but it seems that this parameter is always empty when the action is executed. Any ideas?

 

 

private String attachmentToRemove;

public String getAttachmentToRemove() { return this.attachmentToRemove; }

public void setAttachmentToRemove(String el) { this.attachmentToRemove = el; }

 

public void deleteAttachment() {

System.debug('PARAM::::::::::::: ' + attachmentToRemove);

}

 From the logs: 

 

PARAM:::::::: null

 

<apex:commandLink value="Remove" title="Remove attachment" action="{!deleteAttachment}" onclick="showRemoveFileLoadingIcon('{!attachment.id}'); reRender="fileListing">

<apex:param assignTo="{!attachmentToRemove}" value="{!attachment.id}" />

</apex:commandLink>

 

it seems that the "{!attachmentToRemove}" is never called? 

 

Thanks 

 

Message Edited by lopezc on 02-18-2010 03:23 AM
  • February 18, 2010
  • Like
  • 0

Hi,

 

i am getting the following exception when creating an attachment:

 

System.Exception: DML currently not allowed 

Class.AttachmentSearchController.getInsertAttachment: line 18, column 44External entry point 

 

It is failing on this line of my code: Database.SaveResult insertResult = Database.insert(attachment); 

 

and my attachment looks like this:   

 Attachment Attachment:{Name=Test Attachments.txt, ParentId=003S0000005w8WiIAI, Body=Blob[0]}

 

 Any ideas why it is failing?

Message Edited by lopezc on 01-28-2010 08:21 AM
  • January 28, 2010
  • Like
  • 0
Hi, On Case creation page, we have on checkbox (at bottom) called 'Assign using active assignment rules'. My requirement is, I have to perform some extra work if User select this checkbox. So is there any way in Trigger/ Apex where we can fetch the value of this checkbox. I guess we don't have any field in Case object and also tried with some code, but I am getting null value in 'opts.AssignmentRuleHeader' field. Case c = Trigger.new[0]; Database.Dmloptions opts = c.getOptions(); System.debug('!@# ' + opts); Thanks in advnace.

Hi 

 

I am using radio buttons in my VF page. I noticed that you can change the selection, but not deselect any from being chosen. Is this unavoidable?

HI,

 

I have a visualforce page embedded in a detail page, after pressing a button within my VF page, the oncomplete need to redirect the parent page, I am using JavaScript for this:  

 

 

<script language="JavaScript">

function openUserStoryView(workid){    
	parent.location.href = '{!URLFOR($Action.ADM_Work__c.View,workid)}';
}
 </script>

..................

<apex:commandButton value="Create Story" action="{!createStory}" oncomplete="openUserStoryView('{!recordCreatedId}')"/>

 The error appears when I reload the page, the visualforce page embedded shows:

 

Content cannot be displayed: Invalid parameter for function URLFOR


Any ideas why?

 

 

Hi, 

 

Using Salesforce.schema within eclipse I have created the below SOQL that returns one row:

 

Select (Select IB_Master_Account__c, IB_Prospect__c From IB_Info__r), (Select IB_Account__c, Prospect__c From Content__r), (Select IB_Master_Account__c, IB_Prospect__c From Commerical_Terms__r) From Lead l where id = '00QS0000004Snxg'

 

 

I tried to add the same SOQL to my apex class but when I try to save it in the server it gives me the following error:

 

 

List<Lead> listL = [Select (Select IB_Master_Account__c, IB_Prospect__c From IB_Info__r), (Select IB_Account__c, Prospect__c From Content__r), (Select IB_Master_Account__c, IB_Prospect__c From Commerical_Terms__r) From Lead l where id = '00QS0000004Snxg'];

Didn't understand relationship 'Content__r' in FROM part of query call.

 

 

 

Why is it not working within using apex but it works using either Execute Anonymous or the Salesforce.schema tool?

 

Hi,

 

I need to pass an ID to the action executed when pressing the commandButton, I have done how it is shown in the code beloq but it is not working. The action is called but the parameter is not set so I dont have access to the ID within the controller. Any ideas why?

 

 

<apex:component controller="MyRequestsController">
<apex:attribute name="windowsLogin" description="windows user name" type="String" required="required" assignTo="{!alias}"/>
<apex:attribute name="contactId" description="contact Id" type="ID" required="required" assignTo="{!contactId}"/>
	<apex:form >
		<h2>Previous Requests</h2>		
		<apex:pageblock id="openqueries">
		<apex:pageBlockTable value="{!currentQueryBatch}" var="query" columns="7" styleClass="query-table">
		             <apex:column headerValue="Request Number"><a href="requestTicket/RequestDetailsView?id={!query.id}"><apex:outputText value="{!query.Name}"/></a></apex:column>
		            <apex:column headerValue="Subject" value="{!query.Subject__c}"/>
		            <apex:column headerValue="Status" value="{!query.Status__c}"/>
		            <apex:column headerValue="Team" value="{!query.Team_Name__c}"/>
		            <apex:column headerValue="Date" value="{!query.CreatedDate}"/>
		            <apex:column headerValue="OwnerId" value="{!query.OwnerId}"/>
		            <apex:column headerValue="Approval Status" value="{!query.Approval_Status__c}" rendered="{!OR(openQueriesDisplayed,closedQueriesDisplayed)}"/>
		            <apex:column rendered="{!approvalQueriesDisplayed}">
                		<apex:facet name="header">Action</apex:facet>
                        	<apex:commandButton value=" Approve " action="{!approveRequest}">
                        	<apex:param name="queryId" assignTo="{!queryId}" value="{!query.Id}" />
                        	</apex:commandButton>
                        	<apex:commandButton value=" Reject " action="{!rejectRequest}">
                        	<apex:param name="queryId" assignTo="{!queryId}" value="{!query.Id}" />
                        	</apex:commandButton>
            	   </apex:column>
		</apex:pageBlockTable>
		</apex:pageblock>
	</apex:form>
</apex:component>

 

 

 

Hi,

 

I am query the data base to get the SUM(Amount__c), the table has 6 records with amounts 100 and 10. How Can it be possible that the SUM gives me 74.0?

 

Here is the the data saved in the LedgerTransaction__c  table:

 

 

 [SELECT Amount__c

FROM  LedgerTransaction__c where

and Transaction_Type__c = 'Cash In'

and Ledger_Summary__c = 'a1220000000LPDJAA4'];

 

 

Result:

 

(LedgerTransaction__c:{Id=a0PS0000000zGrMMAU, Amount__c=100.00}, LedgerTransaction__c:{Id=a0PS0000000zJ49MAE, Amount__c=10.00}, LedgerTransaction__c:{Id=a0PS0000000zJ4EMAU, Amount__c=10.00}, LedgerTransaction__c:{Id=a0PS0000000zJ4OMAU, Amount__c=10.00}, LedgerTransaction__c:{Id=a0PS0000000zJ4TMAU, Amount__c=10.00}, LedgerTransaction__c:{Id=a0PS0000000zJ7cMAE, Amount__c=10.00})

 

 

 

AggregateResult[] ec= [SELECT SUM(Amount__c),COUNT(Id) FROM  LedgerTransaction__c where Amount__c > 0
and Transaction_Type__c = 'Cash In'
and Days_Since_Transaction__c <= 60
and Ledger_Summary__c = 'a1220000000LPDJAA4' 
GROUP BY Ledger_Summary__c];
System.debug(ec);

 

 [SELECT SUM(Amount__c),COUNT(Id)

                                         FROM  LedgerTransaction__c                                   

                                         and Transaction_Type__c = 'Cash In'

                                         and Ledger_Summary__c = 'a1220000000LPDJAA4' 

                                        GROUP BY Ledger_Summary__c];

 

Result: (AggregateResult:{expr0=74.0, expr1=6})

 

 

Any Ideas?

  • April 22, 2010
  • Like
  • 0

Is it possible to do something like:

 

Select Id from Contact where TODAY - Activated_Date_c >= 5

 

I am getting the error unexpected char '-'

  • April 21, 2010
  • Like
  • 0

Hi

 

I would like to retrieve information from the parent of the Account linked to a contact. The query is based on the object Contacts, is it possible to do it?

 

Something like:

 

Select Account.ParentId.FieldName__c from Contact 

  • April 21, 2010
  • Like
  • 0

Hi, 

 

I dont see the datepicker in the page, Am I missing something? javascript? Css?

 

My Component:

 

<apex:component controller="HRFormController">
<apex:panelGrid columns="2" cellpadding="0" cellspacing="0">

<apex:outputLabel value="FirstName:" for="firstname"/>	
<apex:inputText id="firstname" value="{!ControllerCase.HEAT_Firstaname__c}" styleclass="text"/>

<apex:outputLabel value="Surname:" for="surname"/>	
<apex:inputText id="surname" value="{!ControllerCase.HEAT_Surname__c}" styleclass="text"/>

<apex:outputLabel value="Start Date" for="joinerStartDate"/> <apex:inputField id="joinerStartDate" value="{!ControllerCase.HEAT_Start_Date__c}"/> 
<apex:outputLabel value="Start Date" for="joinerStartDate"/>
<apex:inputField id="joinerStartDate" value="{!ControllerCase.HEAT_Start_Date__c}"/> 

</apex:panelGrid>
</apex:component>

 

 

  • April 07, 2010
  • Like
  • 0

Hi,

 

I have implemented a Scheduled job that run everyday at 6am. The apex class retrieves a few clients that match a given criteria and calls a @future method to send an email out to each of those clients. Inside the @future method the email is sent doing a call out to a third party. We do individual call outs for each client. The first call out works for the first client but the second and the rest return the following error:

 

System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out

 

Does it mean that we can't do consecutive call outs within the same @future methods?

 

 

global void execute(SchedulableContext sc){
  TradeSenseEmailSender.sendTradeSenseEmail(mapOfIds);	
}

@future(Callout=true)
public static void sendTradeSenseEmail(Map<ID,ID> mapOfIds){ 
    ......
    for each clientFound{
           Http http = new Http();
 	   HttpRequest req = new HttpRequest();	  
           //Add the xml message headers               
           Map<string, string> headers = new Map<string, string>();      
           headers.put('content-length', '0');
           headers.put('Content-type','application/x-www-form-urlencoded; charset=UTF-8');
           req.setHeader('content-length', headers.get('content-length'));
           req.setHeader('Content-type', headers.get('Content-type'));
           req.setTimeout(60000);             
           req.setEndpoint(endpoint);
           req.setMethod('POST');
           req.setBody(EncodingUtil.urlEncode(xml,'UTF-8'));        
           //send the request    
           try{
              HttpResponse res = http.send(req);    
           }catch{
              System.debug(ex.getMessage());
           }  	        
    }
}

 

 

  • April 06, 2010
  • Like
  • 0

Hi,

 

I have a component. It is a form with 2 fields. I don't know a priori which field will be rendered. I have a method in my controller that tells if the field should be displayed or not, the name of the field has to be passed:

 

 

 

 public Boolean displayField(String fieldName){

     if(fieldName!=null){

     for(String field : fields){

     if(fieldName.compareTo(field)==0){

     return true;

     }

     }

     }

     return false;

    }

 

 

  And within my component I want to be able to call the method from the rendered attribute:

 

<apex:outputPanel rendered="">

<apex:outputLabel value="First Name:" for="firstName"/>

<apex:inputText id="firstName" value="{!ControllerCase.HEAT_First_Name__c}" styleclass="text"/>

</apex:outputPanel>

 

<apex:outputPanel rendered="">  

<apex:outputLabel value="Surname:" for="surname"/>

<apex:inputText id="surname" value="{!ControllerCase.HEAT_Surname__c}" styleclass="text"/>

</apex:outputPanel>

 Is there a way to do so?

 
Message Edited by lopezc on 04-01-2010 03:10 AM
  • April 01, 2010
  • Like
  • 0

Can I have SalesforceComponent class in a separate file? At the moment it only works if I put them together:

 

 

public without sharing class Components {

public interface Component {

String getDescription(Case caseN);

String getComponentName();

}

public class SalesforceComponent implements Component{

public String getDescription(Case caseN){

String template = '';

template += 'Desk move:' + (String)((caseN.HEAT_Desk_Move__c)? 'Yes' : 'No') + '\n';

template += 'Report/Dashboards:' + caseN.HEAT_Salesforce_ReportDasboards__c + '\n';

if(caseN.HEAT_Salesforce_ReportDasboards__c){

template += 'Changes Required:' + caseN.HEAT_Salesforce_ReportDashboar_Changes__c + '\n';

template += 'Link to Existing Report:' + caseN.HEAT_Salesforce_ReportDashboar_Link__c + '\n';

}

template += 'New User:' + (String)((caseN.HEAT_Salesforce_New_User__c)? 'Yes' : 'No') + '\n';

if(caseN.HEAT_Salesforce_New_User__c){

template += 'New User Username:' + caseN.HEAT_Salesforce_New_User_Username__c + '\n';

template += 'New User Email Address:' + caseN.HEAT_Salesforce_New_User_Email__c + '\n';

template += 'New User Team:' + caseN.HEAT_Salesforce_New_User_Team__c + '\n';

}

template += 'Demo Conversion:' + (String)((caseN.HEAT_Salesforce_Demo_Conversion__c)? 'Yes' : 'No') + '\n';

template += 'Webinar:' + (String)((caseN.HEAT_Salesforce_Webinar__c)? 'Yes' : 'No') + '\n';

template += 'Other Area:' + caseN.HEAT_Salesforce_Areas__c + '\n';

template += 'More Details:' + caseN.HEAT_Salesforce_More_Details__c + '\n';

return template;

}

public String getComponentName(){

return 'Salesforce';

}

}

} 

 

 

Message Edited by lopezc on 03-18-2010 05:05 AM
  • March 18, 2010
  • Like
  • 0

Hi,

 

I have a Visualforce page embedded on the detail page of a custom object.

 

I have defined a command button in the visualforce page and has its own functionality.

 

As an Administrator, when i click on this Command button it should perform its defined functionlaity and also this detail page should be redirectd to some other page specified in the url.

 

But I click on this, only vf component is being redirected to specified but not entire detail page.

 

I had used javascript code with an onclick event on command button to perform the same but its not functioning consistently.

 

 I am now trying with apex code:

 

 Here is my sample code:

 

public pagereference reactivate(){
        ApproveItems.approveUserRequest(u.Id);
       
        String str='window.parent.location.href("/{!usr.User__r.Id}/e?retURL=%2F{!usr.User__r.Id}&active=1&Profile={!ProfileId}&Title={!URLENCODE(User_Request__c.Title__c)}&00N20000000sJNj={!User_Request__c.Legacy_User_ID__c}")';
        System.debug('######### User Id:'+ usr.User__r.Id);
       
        //PageReference newPage=new PageReference('/' + usr.User__r.Id);
        PageReference newPage=new PageReference(str);
        newPage.setRedirect(true);
        return newPage;
    }

 Regards,

Raj

 

Hi,

I know that an update on a child of the account (Contacts) locks the account, At the moment I have all my contacts linked to a unique account... what happens if I split this account in different accounts but I create a parent account and then all the splited accounts holding from it? will it lock my grand parent when updating a contact?

 

 

Thanks

 

  • March 02, 2009
  • Like
  • 0