You need to sign in to do that
Don't have an account?
Raja Jammula
javascript error: invalid or unexpected token { can anyone please help
Javascript: I am getting Unexpected token error for below code can you please help:
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
var obj;
var task5;
var recordtypeid;
var followup;
var recordtypefol;
if("{!$Profile.Name}" == "TX1" ||
"{!$Profile.Name}"== "TX2"||
"{!$Profile.Name}"== "WX1"||
"{!$Profile.Name}"== "WX2"||
"{!$Profile.Name}"== "WX3"||
"{!$Profile.Name}"== "WX4"||
"{!$Profile.Name}" == "CC"){
obj='a1r';
}
else{
obj='00T';
}
alert(obj);
var url='/'+obj+'/e?CF00N50000002CzJi={!Account.Name}&CF00N50000002CzJi_lkid={!Account.Id}&retURL=/{!Contact.Id}&title=Call&who_id={!Contact.Id}&00N50000002D0zP={!User.Primary_Product__c}'
if(obj=="a1r")
{
url+='&followup=1&tsk5=call'
}
if(obj=="00T"){
if("{!$Profile.Name}" == "WI" && ("{!$UserRole.Name}"=="AS - E"||"{!$UserRole.Name}"=="AS - M"||"{!$UserRole.Name}"=="AS - T")){
task5="Meeting";
recordtypeid="0123B0000008tqK";
followup='';
recordtypefol="0123B0000008tqK";
}elseif("{!$Profile.Name}" == "WI Corporate Sales") {
task5="call";
recordtypeid="01250000000HiDD";
followup ="1";
recordtypefol="01250000000HiDD";
}else{
url+='&tsk5='+task5+'$tsk12=Completed'+'&RecordType='+recordtypeid+'&RecordType_fu='+recordtypefol+'&followup='+followup+'&tsk4={!TODAY()}'
}
}
else{
url+='&followup=1&tsk5=call'
}
window.parent.open(url, "_self");
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
var obj;
var task5;
var recordtypeid;
var followup;
var recordtypefol;
if("{!$Profile.Name}" == "TX1" ||
"{!$Profile.Name}"== "TX2"||
"{!$Profile.Name}"== "WX1"||
"{!$Profile.Name}"== "WX2"||
"{!$Profile.Name}"== "WX3"||
"{!$Profile.Name}"== "WX4"||
"{!$Profile.Name}" == "CC"){
obj='a1r';
}
else{
obj='00T';
}
alert(obj);
var url='/'+obj+'/e?CF00N50000002CzJi={!Account.Name}&CF00N50000002CzJi_lkid={!Account.Id}&retURL=/{!Contact.Id}&title=Call&who_id={!Contact.Id}&00N50000002D0zP={!User.Primary_Product__c}'
if(obj=="a1r")
{
url+='&followup=1&tsk5=call'
}
if(obj=="00T"){
if("{!$Profile.Name}" == "WI" && ("{!$UserRole.Name}"=="AS - E"||"{!$UserRole.Name}"=="AS - M"||"{!$UserRole.Name}"=="AS - T")){
task5="Meeting";
recordtypeid="0123B0000008tqK";
followup='';
recordtypefol="0123B0000008tqK";
}elseif("{!$Profile.Name}" == "WI Corporate Sales") {
task5="call";
recordtypeid="01250000000HiDD";
followup ="1";
recordtypefol="01250000000HiDD";
}else{
url+='&tsk5='+task5+'$tsk12=Completed'+'&RecordType='+recordtypeid+'&RecordType_fu='+recordtypefol+'&followup='+followup+'&tsk4={!TODAY()}'
}
}
else{
url+='&followup=1&tsk5=call'
}
window.parent.open(url, "_self");
All Answers
URL not populating correctly for "00T" user and for all other users: Unable to Access Page
The value of the "id" parameter contains a character that is not allowed or the value exceeds the maximum allowed length. Remove the character from the parameter value or reduce the value length and resubmit. If the error still persists, report it to our Customer Support team. Provide the URL of the page you were requesting as well as any other related information.
can you helpme where i am going wrong
Send me the line# for JS error with full error message and for SF error send me the url (variable) value
Error:Unable to Access Page
The value of the "id" parameter contains a character that is not allowed or the value exceeds the maximum allowed length. Remove the character from the parameter value or reduce the value length and resubmit. If the error still persists, report it to our Customer Support team. Provide the URL of the page you were requesting as well as any other related information.
URL:https://XXXX.my.salesforce.com/00T/e?CF00N50000002CzJi=C2PM&CF00N50000002CzJi_lkid=0015000001HxOaW&retURL=/0035000002plAz0&title=Call&who_id=0035000002plAz0&00N50000002D0zP=DC
When i am Logging in as a user with profile: WI and also with Role AS - E the URL is not populating correctly
When i am Logging in as a user with profile: WX2 it's throwing javascript error: "call not defined"
CF00N50000002CzJi_lkid={!Account.Id}
00N50000002D0zP={!User.Primary_Product__c}
this button is on contact: detail page button so we are pulling in related account and product related to the user. it's the custom button similar functionality to "Log a call" Standard button
if("{!$Profile.Name}" == "TX1" ||
"{!$Profile.Name}"== "TX2"||
"{!$Profile.Name}"== "WX1"||
"{!$Profile.Name}"== "WX2"||
"{!$Profile.Name}"== "WX3"||
"{!$Profile.Name}"== "WX4"||
"{!$Profile.Name}" == "CC")
URL:a1r /e?CF00N50000002CzJi={!Account.Name}&CF00N50000002CzJi_lkid={!Account.Id}&retURL=/{!Contact.Id}&title=Call&who_id={!Contact.Id}&00N50000002D0zP={!User.Primary_Product__c}&followup=1&tsk5=Call
if profile not equal to above profiles: 00T/e?CF00N50000002CzJi={!Account.Name}&CF00N50000002CzJi_lkid={!Account.Id}&retURL=/{!Contact.Id}&title=Call&who_id={!Contact.Id}&00N50000002D0zP={!User.Primary_Product__c}&followup=1&tsk5=Call
but i need to include different conditions on the above part "00T":
if("{!$Profile.Name}" == "WI" && ("{!$UserRole.Name}"=="AS - E"||"{!$UserRole.Name}"=="AS - M"||"{!$UserRole.Name}"=="AS - T"))
then&tsk5=Meeting and URL should not include followup
and if("{!$Profile.Name}" == "WI" && ("{!$UserRole.Name}"!="AS - E"||"{!$UserRole.Name}"!="AS - M"||"{!$UserRole.Name}"!="AS - T"))
then &followup=1&tsk5=Call but include Recordtypes &RecordType="01250000000HiDD"&RecordType_fu="01250000000HiDD"
that's my criteria and basically what i am trying to achieve
I tested both scenarios you mentioned above and no error occurs for me. It might be something related to Data.
Can you send me the final url generated in both cases?
<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