• ag_name
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 2
    Replies

Hello, 

 

I'm trying to experiment using the codes for integrating rest api and php by Mr. Pat Patterson,  I wanted to insert the variable $id parameter to the following soql string query but it isn't working. Please help.

 

function show_accounts($instance_url, $access_token,$id) {
    $query = "SELECT Name, Id from Account WHERE Id =: \'' $id '\'";
    $url = "$instance_url/services/data/v20.0/query?q=" .    urlencode($query);
.
.
.
.

}

 

The $id parameter should be salesforce id that will return by the query. Am I missing something? Please advise.

 

Hello Community,

 

I would like to ask about the best practice and direction to the below requirement.

 

We have a Salesforce Enterprise and a website made with wordpress. In our website we have a my account page that pull records from Salesforce. What is the best approach in pulling the records from Salesforce?

 

Thanks in Advance

Hello Community, 

 

I am using a controller to show a list of records by a wrapper class. From the vf page, I included a checkbox for the user to just selects the records to be process in the next page using the same controller. The issue is that the checkbox boolean is not being considered in the wrapper class that is why the second page shows empty record. Below are the wrapper methods and pages. I tried to do a system.debug to print the value of 'selectedForward' and it returns all false even if you click the checkboxes. 

 

Please give me some suggestions.

 

//Controller

 

public class HomeAdminCls {


public List<Timesheet_Period__c> clientProject {get; set;}
public List<Timesheet_Detail__c> tsDetail {get; set;}
public String tsID {get; set;}
//variables for the search

public HomeAdminCls(){
this.clientProject = 'query here';
}
 
public List<timeSheetPeriod> getListClientProjectResult(){

List<timeSheetPeriod> wrapperList = new List<timeSheetPeriod>();
for(Timesheet_Period__c tw: this.clientProject){
timeSheetPeriod periodList = new timeSheetPeriod();
periodList.name = tw.Name;
periodList.eDate = tw.End_Date__c.format();
periodList.sDate = tw.Start_Date__c.format();
periodList.status = tw.Status__c;
periodList.totalHours = String.valueOf(tw.Total_Hours__c);
periodList.recId = tw.Id;
periodList.projName = tw.Project__r.Name;
periodList.projId = tw.Project__c;
periodList.sDateOrig = tw.Start_Date__c;
periodList.fullName = tw.Timesheet_User__r.Name+' '+tw.Timesheet_User__r.Last_Name__c;
periodList.clientName = tw.Project__r.Company__r.Name;
periodList.mngrName = tw.Project__r.Consultant_Manager__r.Name+' '+tw.Project__r.Consultant_Manager__r.Last_Name__c;
periodList.dateCreated = tw.CreatedDate.format();
periodList.projManager = tw.Project__r.Project_Manager__c;
wrapperList.add(periodList);
}

return wrapperList;

}

public List<timeSheetPeriod> getListClientProject(){

List<timeSheetPeriod> wrapperListFinal = new List<timeSheetPeriod>();
for(timeSheetPeriod tw: getListClientProjectResult()){
timeSheetPeriod periodList = new timeSheetPeriod();

if(tw.status != 'For Approval' && tw.projManager != null){

periodList.name = tw.name;
periodList.eDate = tw.eDate;
periodList.sDate = tw.sDate;
periodList.status = tw.status;
periodList.totalHours = tw.totalHours;
periodList.recId = tw.recId;
periodList.projName = tw.projName;
periodList.projId = tw.projId;
periodList.sDateOrig = tw.sDateOrig;
periodList.fullName = tw.fullName;
periodList.clientName = tw.clientName;
periodList.mngrName = tw.mngrName;
periodList.dateCreated = tw.dateCreated;
periodList.selectedForward = tw.selectedForward;
wrapperListFinal.add(periodList);


}
}
return wrapperListFinal;

}
public List<timeSheetPeriod> getListClientProjectSelected(){

List<timeSheetPeriod> wrapperList = new List<timeSheetPeriod>(getListClientProject());
List<timeSheetPeriod> wrapperListFinal = new List<timeSheetPeriod>();

for(timeSheetPeriod tw: getListClientProject()){
timeSheetPeriod periodList = new timeSheetPeriod();

System.debug('#checkbox value is:'+tw.selectedForward);

if(tw.selectedForward == true){

periodList.name = tw.name;
periodList.eDate = tw.eDate;
periodList.sDate = tw.sDate;
periodList.status = tw.status;
periodList.totalHours = tw.totalHours;
periodList.recId = tw.recId;
periodList.projName = tw.projName;
periodList.projId = tw.projId;
periodList.sDateOrig = tw.sDateOrig;
periodList.fullName = tw.fullName;
periodList.clientName = tw.clientName;
periodList.mngrName = tw.mngrName;
periodList.dateCreated = tw.dateCreated;
wrapperListFinal.add(periodList);

}
}
return wrapperListFinal;

}
 

}

public PageReference forwardTimesheets(){
PageReference pageRef= new PageReference('/apex/HomeAdminForward');
pageRef.setredirect(false);
return pageRef;
}

public class timeSheetPeriod{
public String name {get; set;}
public Id recId {get; set;}
public String sDate {get; set;}
public String eDate {get; set;}
public String status {get; set;}
public String contactName {get; set;}
public String totalHours {get; set;}
public String projName {get; set;}
public String projId {get; set;}
public Date sDateOrig {get; set;}
public String notes {get; set;}
public String fullName {get; set;}
public String clientName {get; set;}
public String mngrName {get; set;}
public String dateCreated {get; set;}
public String projManager {get; set;}
public Boolean selectedForward {get; set;}


public timeSheetPeriod(){
this.name = '';
this.sDate = '';
this.eDate = '';
this.status = '';
this.contactName = '';
this.totalHours = '';
this.projName = '';
this.projId = '';
this.clientName = '';
this.selectedForward = false;
this.projManager = '';
}
}
 
}
 

 

// first page main page. where the checkbox resides.

 

<apex:page controller="HomeAdminCls" showHeader="false" sidebar="false">

<apex:pageBlock title="Dashboards" id="dueTSId">
<apex:facet name="header">
&nbsp; <span style="color:white;">Dashboards</span>
</apex:facet>

<apex:form id="tsForm">
<apex:outputPanel id="searchResult">
<apex:pageBlockSection collapsible="false" columns="1" title="My Projects">
<apex:facet name="header">
<span style="color:white;">Search Results</span>
</apex:facet>
<apex:pageBlockTable title="Search Results" width="100%" value="{!ListClientProjectResult}" var="projList" >

<apex:column headerValue="Period">
<apex:outputLink value="#" onclick="execDetail('{!projList.recId}'),pageScroll()">{!projList.name}</apex:outputLink>
</apex:column>
<apex:column headerValue="Client" value="{!projList.clientName}" />
<apex:column headerValue="Project" value="{!projList.projName}" />
<apex:column headerValue="External Manager" value="{!projList.mngrName}" />
<apex:column headerValue="Name of Timesheet Owner" value="{!projList.fullName}" />
<apex:column headerValue="Status" value="{!projList.status}" />
<apex:column headerValue="Total Hours" value="{!projList.totalHours}" />
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:outputPanel>
<hr />

<apex:outputPanel id="timesheetList">
<apex:pageBlockSection collapsible="false" columns="1" title="My Projects">
<apex:pageBlockTable title="My Clients" width="100%" value="{!ListClientProject}" var="projList" >

<apex:column headerValue="Period">
<apex:outputLink value="#" onclick="execDetail('{!projList.recId}')">{!projList.name}</apex:outputLink>
</apex:column>
<apex:column headerValue="Client" value="{!projList.clientName}" />
<apex:column headerValue="Project" value="{!projList.projName}" />
<apex:column headerValue="External Manager" value="{!projList.mngrName}" />
<apex:column headerValue="Name of Timesheet Owner" value="{!projList.fullName}" />
<apex:column headerValue="Status" value="{!projList.status}" />
<apex:column headerValue="Total Hours" value="{!projList.totalHours}" />
<apex:column headerValue="Forward to Client">
<apex:inputCheckbox value="{!projList.selectedForward}"/>
</apex:column>
</apex:pageBlockTable>
<div style="float:right;padding-right:30px">
<apex:commandButton value="Forward" action="{!forwardTimesheets}"/>
</div>
</apex:pageBlockSection>
</apex:outputPanel>

</apex:form>
</apex:pageBlock>
 
</apex:page>

 

 

 

// second page HomeAdminForward from pagereference

 
<apex:page controller="HomeAdminCls" showHeader="false" sidebar="false">

<apex:pageBlock title="Dashboards" id="dueTSId">

<apex:form id="tsForm">

<apex:outputPanel id="timesheetList">
<apex:pageBlockSection collapsible="false" columns="1" title="My Projects">

<apex:pageBlockTable title="Forward to Client for Approval" width="100%" value="{!ListClientProjectSelected}" var="fList" >

<apex:column headerValue="Period">
<apex:outputLink value="#" onclick="execDetail('{!fList.recId}'),pageScroll()">{!fList.name}</apex:outputLink>
</apex:column>
<apex:column headerValue="Client" value="{!fList.clientName}" />
<apex:column headerValue="Project" value="{!fList.projName}" />
<apex:column headerValue="External Manager" value="{!fList.mngrName}" />
<apex:column headerValue="Name of Timesheet Owner" value="{!fList.fullName}" />
<apex:column headerValue="Status" value="{!fList.status}" />
<apex:column headerValue="Total Hours" value="{!fList.totalHours}" />
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:outputPanel>


</apex:form>
</apex:pageBlock>
</apex:page>

 


 

Hello Community,

 

I would like to ask about the best practice and direction to the below requirement.

 

We have a Salesforce Enterprise and a website made with wordpress. In our website we have a my account page that pull records from Salesforce. What is the best approach in pulling the records from Salesforce?

 

Thanks in Advance

I have a problem regarding salesforce email under apex area.

The problem is using 'Html Email Templates' with setTargetObjectId method does not set the User Id:

 

Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); logger.log('User found: ' + caseR.User__c); mail.setTargetObjectId(caseR.User__c); mail.setTemplateId('00XT0000000iwz7'); Messaging.Sendemailresult[] emailResult = Messaging.sendEmail(new Messaging.Email[] { mail } , false); logger.log('Email Result: ' + emailResult);

 

And the logging result says that TargetObjectId is null. Why?:

 

2/01/2010 09:15: User found: 00520000000pjkYAAQ 12/01/2010 09:15: Email Result: (Messaging.SendEmailResult[getErrors=(Messaging.SendEmailError[getTargetObjectId=null;]);isSuccess=false;])

 

Please help!

 

thanks,

Cristina.

  • January 12, 2010
  • Like
  • 0