• sf consultant.ax380
  • NEWBIE
  • 0 Points
  • Member since 2008

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 6
    Replies
USE CASE
User enters data in text area on standard field (non visual force page)  return of save button has been overrriden to call an s-control. .S-control needs to populate the value of the merge field referencing that standard field  in a javascript var and append it to the url for an iframe. (Seems simple)

PROBLEM
Darn CRLF's that are embedded in the Merge Field if user hits enter in the text area field cause disasterous results (unterminated string error) when applying the merge field value to a javascript var.

QUESTION
Why have I constantly been unsuccessful in using Substitute to remove the CRLF??  Has ANYONE gotten this to work?

I've read varous other hacks requiring additional presentation logic of hidden form fields  or hidden divs working but this is not a read only field. The user is entering this right before the s-control is called.  I've heard of maybe run an additonal query either using query or retrieve as opposed to evaling the merge field but this has not seemed to work for me either.

ie. .the below I am using to protect against single and double quotes but I've tried numerous deritives to project against carriage returns and Substitute just doesn't seem to want to do it.

var desc = encodeURI("{! Substitute(Substitute(Case.Description ,"\\","\\\\"),"\"","\\\"")}" );

Any help would be greatly appreciated as I've wasted numerous hours on this. (in any other scenario I would use the full service side power of java to remove unwanted stuff before applying to the javascript var but in the case of Force.com and using an s-control. from my understanding my server side capability in this context is somewhat limited.

Thank you!


Message Edited by sf consultant on 11-26-2008 07:56 AM

Message Edited by sf consultant on 11-26-2008 07:57 AM

Message Edited by sf consultant on 11-26-2008 07:58 AM
Use the web services api

Maybe I'm just not understanding soql after years of using actual SQL. :)  How can statement 1 (with or clause)below return 0 records while statement 2 (no or clause) returns records???  It's an "or" clause.. I'm not getting it!!

I would think no matter what the 2nd 1/2 of the or clause evals to the 1st part should still return me some records.
A cut and paste of the soql (with the or clause) into eclipse in the schema browser IS returning records.. I'm even more perplexed now.

The email parm is the same passed in both statements.The obect being evalued is the junction table in a many to many relationship.

binding.service.soap_address = https://www.salesforce.com/services/Soap/c/14.0

Someone please stop my madness and help!!! LOL

Code:
        soql =   "    Select     i.KBDocSubscribed_To__c "
            +    "    From     INET_KBDocSubscription_Bridge__c i "
            +    "    Where     KBDocSubscription_Parent__r.Email__c like '"+email+"%'"
            +    "    or         KBDocSubscription_Parent__r.Contact__r.email like '" + email + "%'";

        soql =   "    Select     i.KBDocSubscribed_To__c "
            +    "    From     INET_KBDocSubscription_Bridge__c i "
            +    "    Where     KBDocSubscription_Parent__r.Email__c like '"+email+"%'";
.....
res = binding.query(soql);
.....

 

        
Hello all,

We have users that create html documents on the fly in our application.. some may include images.. these images our stored in our DB as blobs.. Currently we use the javax.mail classes but want to switch to the SF Web Services API to send the email. 

In our current version of our 3rd party application,  HTML Images are included as attachments to the email as opposed to absolute URL's as they are stored as blobs in the database and do not exist on any file system. The HTML references the images using the protocol prefix cid: and the content id of the attachment.

I’m looking at the SF web services API and trying to find something I can use to duplicate this.  I see the setFileAttachments and setDocumentAttachments methods but I’m thinking these are not what I want to use?

Any ideas are appreciated!!!

The below is more pseudo then actual code but you should get the idea.

Code:
-------Using the javax.mail classes........
messageBodyPart = new MimeBodyPart();
DataSource fds = new FileDataSource("C:\\images\\jht.gif");
messageBodyPart.setDataHandler(new DataHandler(fds));
messageBodyPart.setHeader("Content-ID","<image>");
multipart.addBodyPart(messageBodyPart);
message.setContent(multipart);
transport.connect();
transport.sendMessage(message,

---------in the SF web service API...
com.sforce.soap.enterprise.SingleEmailMessage email =              new SingleEmailMessage()
email.setFileAttachments(i, _value)
email.setFileAttachments(fileAttachments);                                       
email.setDocumentAttachments(i, _value)
email.setDocumentAttachments(documentAttachments)

 



Message Edited by sf consultant on 09-09-2008 12:03 PM
Hi,
 
I'm opening my application through an SControl and redirecting to our URL.  We then perform some operations and want the parent window (SFDC) to refresh.  However, when I use
 

Hi

I am using a Custom Control to redirect our users to the Edit Contact Page.
I am also passing some account information in the query string.

This has been working fine, Except when trying to access one of our custom fields (an address field) where the user has put carriage returns in the data.

i.e.
      17 Hammer Street
      Hammer house

Now i am using javascript to redirect the user to the contact page. Whenever i try access the field that has carriage returns on it, the javascript does not seem to execute. Trying different accounts without this carriage return worked fine.
I tried replacing the carriage return, but cannot even get that far.

I reduced the script in the sforce control to the following:

<script language="JavaScript">
function showaddress()
{
       alert("{!Account_WCF_Billing_Street}");
}
showaddress();
</script>

Again, this code runs fine for accounts in which this custom field has no carriage returns, yet just doesn't run for fields with carriage returns.

Any way around this, TIA