+ Start a Discussion
Prad NethasPrad Nethas 

Visual Force Email template error.

Hi All,

I have a Visual force email template on a workflow action. That will fire upon creation of Account and when it meets a check box to true and not a specific profile user. To test it I also have added the task, which creates parallalely. 
Problem I am facing is when I have added the component to the Vf email template then My Vf Template is giving me an error 
Below is the error 

Error occurred trying to load the template for preview: List has no rows for assignment to SObject. Please try editing your markup to correct the problem.

What could be the possible issue can you please help me out on this.

Below is my class for the vf component which gets account id.

public class CTBnewmyresourceemail {
    List<asset> assetlist = new List<asset>();
    Account accdetails = new Account();
    public id recId;
    public Account thisAccountId { get; set; }
    public CTBnewmyresourceemail()
    {
    recId = ApexPages.currentPage().getParameters().get('Id');
   
    accdetails = [select id from account where id=:recId limit 1];
    assetlist = [select id,accountid,description from asset where accountid =:accdetails.id];
    //return assetlist;
    }
    public List<asset> getAccount_assets() {
        return assetlist;
    }    
}

Did I made any mistake in it please suggest me.
Also In the visual force page I am trying to display the asset field value of that particular account.

THanks in advance
Prad
Best Answer chosen by Prad Nethas
DebasisDebasis
Hi Prad,

Please pass id as url parameter with any value of accounnt id. Based on this id account are retrivingg and its associateed assets are.


Thanks,
Debasis

All Answers

DebasisDebasis
Hi Prad,

Please pass id as url parameter with any value of accounnt id. Based on this id account are retrivingg and its associateed assets are.


Thanks,
Debasis
This was selected as the best answer
Shaijan ThomasShaijan Thomas
recId = ApexPages.currentPage().getParameters().get('Id'); --> You are not passing this id properly
Thanks
Prad NethasPrad Nethas
Hey thanks for the quick answers but I am getting below error now 

Error occurred trying to load the template for preview: java.lang.reflect.InvocationTargetException. Please try editing your markup to correct the problem.
 
Prad NethasPrad Nethas
hey Thomas,

Thank you 
How can pass id for a work flow email template 
is it wrong way to for gettin id 

Please let me know 

Regards
Prad
Shaijan ThomasShaijan Thomas
I do not think you can pass id from workflow.
You may need to have different approch
Thanks
Joseph CarperJoseph Carper
It do work. Check this (http://theinternetmarketingcentral.net/).