You need to sign in to do that
Don't have an account?
Urgent : users only retrieved his own data in email templates ( Query is not working)
Hi all,
I want to email templates will be send to the corresponding Users.That users only retrieved his own data in email templates.The following query is not executed:
select Name,bid__c.auction__r.name, bid__c.Asset_ST__c,bid__c.Model_No__c,Manufacturer__c,quantity__c,bid_Amount__c,Buyer_Contact__c,Total_Offer__c,Email_Address__c
from bid__c where CreatedDate = today and ownerid =:thisUserId];
Please give some solution:
I listed whole classes,component and email templates
Class:
public class sendoffermail
{
private final List<bid__c> offers;
Id thisUserId;
public Id getthisUserId() {
return thisUserId;
}
public void setthisUserId(Id s) {
thisUserId = s;
}
public sendoffermail()
{
offers= [select Name,bid__c.auction__r.name, bid__c.Asset_ST__c,bid__c.Model_No__c,Manufacturer__c,quantity__c,bid_Amount__c,Buyer_Contact__c,Total_Offer__c,Email_Address__c
from bid__c where CreatedDate = today and ownerid =:thisUserId];
}
public List<bid__c> getofferdata()
{
return offers;
}
}
Components:
<apex:component controller="sendoffermail" access="global">
<apex:attribute name="thisUserId" description="This is the User Id." type="Id" assignTo="{!thisUserId}" />
<pre>
thisUserId = {!thisUserId}
</pre>
<apex:dataTable value="{!offerdata}" var="of" border="1" >
<apex:column >
<apex:facet name="header">auction</apex:facet>
{!of.auction__r.name} </apex:column>
<apex:column >
<apex:facet name="header">Manufacturer</apex:facet>
{!of.Manufacturer__c} </apex:column>
<apex:column >
<apex:facet name="header">ModelNo</apex:facet>
{!of.Model_No__c} </apex:column>
<apex:column >
<apex:facet name="header">quantity</apex:facet>
{!of.quantity__c} </apex:column>
<apex:column >
<apex:facet name="header">bidAmount</apex:facet>
{!of.bid_Amount__c}</apex:column>
<apex:column >
<apex:facet name="header">TotalOffer</apex:facet>
{!of.Total_Offer__c}</apex:column>
</apex:dataTable>
</apex:component>
Email Templates:
<messaging:emailTemplate subject="Your Today Offer Status Displayed Below" recipientType="User" >
<messaging:htmlEmailBody >
<p>Hello {!recipient.name}--</p>
<p>These are Your Today Offer Details</p>
<!-- <c:sendoffermail /> -->
<c:sendoffermail thisUserId="{!recipient.id}" />
</messaging:htmlEmailBody>
</messaging:emailTemplate>
Try one of these -
WHERE OwnerId= :UserInfo.getUserID()
WHERE username=:UserInfo.getUsername()
Thanks for your response..............
ROV