• JohnSword
  • NEWBIE
  • 25 Points
  • Member since 2013

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 4
    Replies

I'm trying to write a custom button to Execute JavaScript in a lead record that will:

- Send an email

- Check a box

- Add today's date to a field

- Display the lead record

 

So far I have the send the email working with:

location.replace('/_ui/core/email/author/EmailAuthor?p2_lkid={!Lead.Id}&rtype=00Q&retURL=%2F{!Lead.Id}&template_id=00Xi0000000h3Qh&p5=&save=1');

 

I tried configuring a second button to check a box with:

{!REQUIRESCRIPT("/soap/ajax/22.0/connection.js")} 

var newRecords = [];
var c = new sforce.SObject("Lead");
c.id ="{!Lead.Id}";
c.00Ni00000046tXe_chkbox = true;
newRecords.push(c);
result = sforce.connection.update(newRecords);
window.location.reload();

 

It gives me an "Unexpected token ILLEGAL" error. 

 

 

Can someone please help:

- Fix the checkbox issue

- Provide the JavaScript to change the date field to the current day

- Combine all 3 actions into 1 button

 

Thanks in advance,

John

 

 

 

 

I'm trying to create a custom button that automatically sends an email to a lead...

location.replace('/_ui/core/email/author/EmailAuthor?p2_lkid={!Lead.Id}&rtype=00Q&retURL=%2F{!Lead.Id}&template_id=00Xi0000000h3Qh&p5=&save=1');

Everything works well until the "&save=1" at the very end which is what actually send the email.

 

Can anyone help me understand what I'm doing wrong?

 

Thanks,

John

 

I'm trying to write a custom button to Execute JavaScript in a lead record that will:

- Send an email

- Check a box

- Add today's date to a field

- Display the lead record

 

So far I have the send the email working with:

location.replace('/_ui/core/email/author/EmailAuthor?p2_lkid={!Lead.Id}&rtype=00Q&retURL=%2F{!Lead.Id}&template_id=00Xi0000000h3Qh&p5=&save=1');

 

I tried configuring a second button to check a box with:

{!REQUIRESCRIPT("/soap/ajax/22.0/connection.js")} 

var newRecords = [];
var c = new sforce.SObject("Lead");
c.id ="{!Lead.Id}";
c.00Ni00000046tXe_chkbox = true;
newRecords.push(c);
result = sforce.connection.update(newRecords);
window.location.reload();

 

It gives me an "Unexpected token ILLEGAL" error. 

 

 

Can someone please help:

- Fix the checkbox issue

- Provide the JavaScript to change the date field to the current day

- Combine all 3 actions into 1 button

 

Thanks in advance,

John

 

 

 

 

I'm trying to create a custom button that automatically sends an email to a lead...

location.replace('/_ui/core/email/author/EmailAuthor?p2_lkid={!Lead.Id}&rtype=00Q&retURL=%2F{!Lead.Id}&template_id=00Xi0000000h3Qh&p5=&save=1');

Everything works well until the "&save=1" at the very end which is what actually send the email.

 

Can anyone help me understand what I'm doing wrong?

 

Thanks,

John