You need to sign in to do that
Don't have an account?

Rich Text field updated without formatting via the REST API
Hello everyone
I have a follow up issue for my previous problem (http://boards.developerforce.com/t5/REST-API-Integration/Updating-records-from-REST-API/m-p/291815#M585).
I have this code from my JAVA application running on Google app engine:
HTTPRequest httpRequest = new HTTPRequest(url, HTTPMethod.POST, FetchOptions.Builder.withDeadline(10)); ... JSONObject update = new JSONObject(); update.put("my_txt", mTxt); httpRequest.setPayload(update.toString().getBytes()); log.severe("payload: " + update.toString()); HTTPResponse response = urlFetchService.fetch(httpRequest);
When I print out the text before sending it I see the spaces, new lines and format are kept and appear OK.
But when I look in my Force.com Org in the relevant Rich Text field I see on long line of text (with not spaces, new lines or any formatting).
Any advice on why is that happening and what am I doing wrong?
Thanks
Oded
You might be able to find some library out there, but it seems like you could just do a replaceAll on your HTML string. Something like:
Right?
All Answers
RTA fields use HTML for formatting, so you must send corresponding HTML. For example, if you want to insert a new custom object with a field called "rta__c", you could send JSON that looks like:
Thanks
Is there any way to reformat the text as HTML (I'm using JAVA) or I need to replace the relevant chars with html tags manual?
You might be able to find some library out there, but it seems like you could just do a replaceAll on your HTML string. Something like:
Right?
Thank you very much
I was hoping to maybe find something on the APEX side but didn't find any.
Are you aware of something?
Oded
If you wanted you could build your own API with Apex REST that does the string substitution. It's a new pilot feature in the latest release.
But there's no built-in API that will do this for you.