function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Raja JammulaRaja Jammula 

URL No longer exists error when executing onclick javascript button can anyone please help

Hi, i am getting this error:
URL No Longer Exists
You have attempted to reach a URL that no longer exists on salesforce.com. 

this is the javascript button i am using:

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

var url='/00T/e?title=Call&who_id={!Contact.Id}&&retURL=/{!Contact.Id}' 

if("{!$Profile.Name}" == "WICS" && ("{!$UserRole.Name}"=="AE - E"||"{!$UserRole.Name}"=="AE - W"||"{!$UserRole.Name}"=="AE - S")){ 
url+='&tsk5=Meeting'; 
url+='&tsk4={!TODAY()}'; 
url+='&tsk12=Completed'; 
url+='&RecordType=0120j0000008dlO'; 
url+='&ent=Task'; 
}else if("{!$Profile.Name}" == "WI Corporate Sales") { 
url+='&tsk5=Call'; 
url+='&followup=1'; 
url+='&tsk4={!TODAY()}'; 
url+='&RecordType=01250000000HiDD'; 
url+='&RecordType_fu=01250000000HiDD'; 
}else{ 
url+='&followup=1'; 
url+='&tsk5=Call'; 
}  
window.open(url,'_blank');

i am not getting where i am going wrong here can anyone help
Best Answer chosen by Raja Jammula
Raja JammulaRaja Jammula
the same page issue is solved used "oncomplete" rather than "onclick" event

All Answers

SVsfdcSVsfdc
Looks like your URL is starting with '/00T/e?title=Call&who_id='
you need to have complete url
 
Raja JammulaRaja Jammula
@svsfdc this is my URL:- var url='/00T/e?title=Call&who_id={!Contact.Id}&retURL=/{!Contact.Id}' 

and i am getting the above error while using this URL 
Raja JammulaRaja Jammula
i changed my button code to vf page and calling dirently from there like below but i am getting an error here can you let me know what to do here

<script>
        function setLogcallURL(){
        var url='/00T/e?title=Call&who_id={!Contact.Id}&retURL=/{!Contact.Id}' 
        
        if("{!$Profile.Name}" == "WI" && ("{!$UserRole.Name}"=="AE - E"||"{!$UserRole.Name}"=="AE - W"||"{!$UserRole.Name}"=="AE - S")){ 
            url+='&tsk5=Meeting'; 
            url+='&tsk4={!TODAY()}'; 
            url+='&tsk12=Completed'; 
            url+='&RecordType=0120j0000008dlO'; 
            url+='&ent=Task'; 
        }else if("{!$Profile.Name}" == "WI Corporate Sales") { 
            url+='&tsk5=Call'; 
            url+='&followup=1'; 
            url+='&tsk4={!TODAY()}'; 
            url+='&RecordType=01250000000HiDD'; 
            url+='&RecordType_fu=01250000000HiDD'; 
        }else{ 
            url+='&followup=1'; 
            url+='&tsk5=Call'; 
        }
        window.open(url,"_self");
        }
    
    </script>
from vf page:
     <apex:commandButton value="Log a Call"  onclick="setLogcallURL()" rendered="{!contact.CSG_Status__c == 'Active'}"/>
when i click a button it's reloading the same page and not calling the url

when i change to window.open(url,'_blank'); then it loads the page in seperate tab.
And &tsk4={!TODAY()} it's not the populating the date correctly 
it's populating as: Tue Sep 26 00:00:00 GMT 2017 instead 09/26/2017

​can you let me know where i am going wrong here
Raja JammulaRaja Jammula
the same page issue is solved used "oncomplete" rather than "onclick" event
This was selected as the best answer