function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
arasuarasu 

Why is my query not retrieving value of Account ID in PrintAnything?

Hi,
 
I am using the basic version of PrintAnything. For some reason, the following SOQL query is returning zero records.
Select a.Name From Account a where a.Id='{!Account.Id}'
 
but when I hard-code the id as follows, it works:
Select a.Name
From Account a where a.Id='0013000000Gbf4MAAR'
 
Appreciate all help to figure out why a.Id='{!Account.Id}' is not working in the query for PrintAnything.
 
Regards,
Ambili
krisckrisc
I dont know anything about PrintAnything but in a general SQL sense, it would seem you are passing the ID varable as a text string as your not escaping the single quotes. It maybe how the system works, by using the {} brackets to escape, but normally i would expect something to be more like.
 
" select * from tablename where theid = ' " &{accountvar}& " ' "
 
so the &'s are used to escape the string to populate the varable from your software... so maybe its something similar you need to do.
 
Like i say, just a total guess...
 
Edit: Just a guess but have you tried taking out the single speechmarks all together so its like;
 
Select a.Name From Account a where a.Id={!Account.Id}


Message Edited by krisc on 05-08-2008 07:54 AM
PerGeertPerGeert

Try to setup your query like:

select a.Name from Account a where a.Id = '{Parameter.accountId}'

On the button, where the report is started (assumed it is on a Account layout), add the parameter:

{!URLFOR(
$SControl.PRINTANY__PrintAnythingDriver,
Event.Id,
[packageId="NameOfYourPackage", accountId=Account.Id])
}

arasuarasu
Hi,
 
Thanks a million for your help...this really works well.
 
Do you know if we can add a hyperlink say "Print this page" in the print form layout that will open the print dialog box? Where should I place the javascript for this purpose?
 
Thanks for all your help.
Regards,
Ambili