+ Start a Discussion
gthyaergthyaer 

OnClick JavaScript Button does not create task correctly

Hello everyone,

 

I have created a JavaScript button which is creating a curious effect. Upon clicking the button, it should create a task alerting another user that a lead is ready for their review. The fields should auto populate with the other users Name and Lead info through the use of a URL hack.

 

Instead, when the task is created, it notifies the creator of the task and attaches to a Contact of the same name as the lead. I find that if I click the magnifying glass next to the Assigned to User Field and the Name Lead field it works correctly. Any idea what might cause this or how to correct it?

 

Below is the button code. Thank you for your help,

 

if ({!Lead.Description} == "ceuenrollment") {
window.location = "/00T/e?tsk1=Certifications%20User&tsk2={!Lead.Name}&RetURL={!Lead.Id}&email=1&tsk2_mlktp=00Q&IsReminderSet=0&tsk5=CEU%20Order";
}

else if ({!Lead.Description} == "certrenew") {
window.location = "/00T/e?tsk1=Certifications%20User&tsk2={!Lead.Name}&RetURL={!Lead.Id}&email=1&tsk2_mlktp=00Q&IsReminderSet=0&tsk5=Cert%20Renewal";
}

else if ({!Lead.Description} == "certreplace") {
window.location = "/00T/e?tsk1=Certifications%20User&tsk2={!Lead.Name}&RetURL={!Lead.Id}&email=1&tsk2_mlktp=00Q&IsReminderSet=0&tsk5=Replacement%20Display%20Certificate%20Request";
}

else {
alert("This lead can not be marked as paid.");
}

Best Answer chosen by Admin (Salesforce Developers) 
hemantgarghemantgarg

for that you have to set one more parameter "tsk1_lkid" and its value should be the id od intended user .

All Answers

hemantgarghemantgarg

try adding some more parameters in the url :-

tsk2_lktp=00Q&tsk2_lkid={!Lead.Id}&save=1

 

it should work then.

gthyaergthyaer
Thank you for taking a crack at it. After adding the code, the problem continues to exist. Any other ideas? ? Thanks again.
hemantgarghemantgarg

what is the error you are facing ?

gthyaergthyaer

I am not recieving any error messages or alerts, however the tasks are notifying the current user instead of the intended user unless the current user reselects the intended user's name using the magnifying glass lookup field.

hemantgarghemantgarg

for that you have to set one more parameter "tsk1_lkid" and its value should be the id od intended user .

This was selected as the best answer
gthyaergthyaer

That seems to work! Thanks!