Can you give exact examples of what you are using for each variable.
I tried this and dont get any issues with it. - See Example http://trycf.com/gist/610a1e84aee0c490f4a2208296f890ee/acf2016?theme=monokai
You shouldn't need the pound signs (#) around the variable Request.RequestID, although it appears to work even with them.
yes it works in CF 11 and previous versions but not working in CF 12
i removed the pound , but still get the same error
firstly i get the result from db:
<cfquery name="Request" DATASOURCE="WES" >
WHERE RequestID = #RequestID#
then do the replace of some text template
<cfset SubjectText = Replace(#SubjectText#,"%Request.RequestID%",#Request.RequestID#,"All")>
What are the actual values though? What does SubjectText and RequestID represent?
If you replace these with the actual values does the same thing happen?
The first thing that I noticed (and this may or may not be part of the issue) is that you are naming the query object using a reserved word: request (as in the request scope.)
<cfset SubjectText = replace(SubjectText,"%Request.RequestID%",Request.RequestID,"all") />
Are you only trying to take an ID number surrounded by percent signs and remove the percent signs?
EDIT: Seems to me that if you're just trying to remove the percent signs, then nested inside the percent signs should be hashmarks because the variable is contained within string demarcation.
<cfset SubjectText = replace(SubjectText,"%#Request.RequestID#%",Request.RequestID,"all") />
Definitely looks like I bug. I ran into the same issue. Like the error says, CF is failing to convert a BigDecimal to a string in order to use it in the replace function. This should work for you.
<cfset SubjectText = Replace(SubjectText,"%Request.RequestID%",javaCast('String',Request.RequestID),"All")>
For reference, here is an example that fails. In my case, the real value for the theBigDecimal was being generated by selecting an integer column from a simple query against Oracle. As you can see below, the javacast from bigdecimal to string works, but whatever it is doing in the replace function fails. I'll see if I can find were to file the bug.
theBigDecimal = javaCast("bigdecimal", 123456);
theBigDecimalasString = javaCast("String", theBigDecimal);
newString = replace('This is my text with documentID in it','documentID',theBigDecimalasString);
writeDump('This Works: ' & newString);
newString = replace('This is my text with documentID in it','documentID',theBigDecimal);
added to bug base