• Ira
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 10
    Replies

I would like to be able to write to a file on the local computer, the Account ID of the account the user is currently accessing.

 

I found the AJAX code that will write to a file, but I don't know how to add this code to a Trigger.

The Trigger being: User has loaded an account.

 

 

Any help would be great. Thanks.

Ira

 

Sample AJAX code:

 

function WriteFile()
{

var fh = fopen("c:\\MyFile.txt", 3); // Open the file for writing

if(fh!=-1) // If the file has been successfully opened
{
    var str = Account.ID; 
    fwrite(fh, str); // Write the string to a file
    fclose(fh); // Close the file
}

}

WriteFile();

I have to send email to a contact with visual basic 6.

I don't want to use a standard smtp because I have to use template and attachment which are saved into SF.

I wrote a similar code in a trigger by apex, but now I want to write code in vb6, it is possibile?

I try to find on the discussion boards but I find only some post which say that it is impossibile send email through api.

 

This is the "easy" code which I use in a trigger :

 

 

trigger send_mail on Opportunity (before update) {
[...]
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
String[] toAddresses = new String[] {'test@test.com'};
mail.setToAddresses(toAddresses );
mail.setReplyTo('replyto@test.com');
mail.setSenderDisplayName('sender@test.com');
mail.setSubject('subjcet');
mail.setPlainTextBody('texttt');
Attachment Att = [Select body, name from attachment where parent.id = 'xxx' and name like 'xxxx%'];
Messaging.EmailFileAttachment[] fileAttachments = new Messaging.EmailFileAttachment[1];
Messaging.EmailFileAttachment fileAttachment = new Messaging.EmailFileAttachment();
mail.setTemplateId(my_template_id);
fileAttachment.setBody(Att.body);
fileAttachment.setFileName(Att.name);
fileAttachments[0] = fileAttachment;
mail.setFileAttachments(fileAttachments);
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });

}

 I think that I have to start with a declaration (dim messaging as new XXX ) of variabile, but the problem is : "what Have I to declare?"

in the dll exist only :

sobject3

sforcesession3

...

 

but i don't find anything about email,thanks

 

 

 

 

 

I would like to create an account triger so when a user access an account a triger will place a record in the SF database or simply write to a local file the Account Name.

 

Would someone please assist me as I know nothing about adding trigers or Apex code.

 

TIA,

Ira

Message Edited by Ira on 01-21-2010 10:34 AM

I was told that when I signed up as a developer, I would have access to a demo database.

I was told that I would use my logon user name and password to logon to Sales Force.

 

I copied the VB code from the PDF and appears to work, but I am getting an error:

 

"Invalid username, password, security token; or user locked out."

 

I assume the User name and/or password is not the correct one to use.

 

I did use WireShark to confirm Internet traffic was occuring when trying to login.

 

Any help would be appreciated,

Ira

I am looking for a way to reformat - by means of a custom formula or something else - a fax number in Sforce that looks like this:

 

(248) 258 0000

 

into a text string like this:

 

12482580000

 

Any suggestions?

 

Eric Fris

ericfris@corporategrowthservices.com