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
Aniruddha.ManakeshwarAniruddha.Manakeshwar 

Need help : getting error for Javascript written for custom button

Hello all,

 

Scenario :

1. I have 3 different types of Record types on Case :  Admin, Proactive , Reactive

2. I have a custom object called as Action Tracker and created a custom button as Track Activity on Case

3. I have only Record type on Action Tracker as Case, and Case page layout is assigned to that record type.

4. Now this Custom button 'Track Activity on Case' provided on Case layout.

5. On Action Tracker, i have created 2 page layouts, one is for Case Record type and one is for Admin Case page layout.

5. When i create Case for record type Admin and if i select Type field value as "Administrative", i want to go to a Admin Case page layout which has one extra field.

6. When i create Case for other record type proactive or reactive, i want to go to Case page layout of Action tracker.

7. Point no.5 & 6 will be done by clicking on "Track Activity on the Case" on Case layout.

8. So for this kind of requirement i tried Javascript to check the condition, to go to different pages. Now i am getting error as "Administration" is not defined, can somebody please suggest, if i can achieve this kind of requirement using single button or do i need to go for Visual page ???

 

below is the Javascript written for Track Activity on the Case button:-

 

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

var caseRecordType = {!Case.RecordType}; 

var caseType={!Case.Type}; 


var adminUrl = "/a0C/e?CF00N30000009VlVC={!Case.CaseNumber}&CF00N30000009VlVC_lkid=(!Case.Id}&retURL=%2F {!Case.Id}&RecordType=012Q00000008spT"; 

var proUrl = "/a0C/e?CF00N30000009VlVC={!Case.CaseNumber}&CF00N30000009VlVC_lkid={!Case.Id}&retURL=%2F{!Case.Id}&RecordType=01230000001Jvss"; 

var otherUrl = "/a0C/e?CF00N30000009VlVC='+{!Case.CaseNumber}+'&CF00N30000009VlVC_lkid='+{!Case.Id}+'&retURL=%2F'+{!Case.Id}+'&RecordType=01230000001Jvss"; 

if(caseRecordType == "Admin" && caseType== "Administrative") 

alert('Admin'); 
window.location.href = adminUrl; 

else if (caseRecordType == 'Proactive' || caseRecordType == 'Reactive') 


window.location.href = proUrl; 


else 

alert('else'); 
window.location.href = otherUrl; 
}

 

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

 

AravindBabu512AravindBabu512

Hi,

 

This can be achieved by page layout assignment based on record types if the requirement was to show different layouts based on record types, but i could see another controlling factor "Case Type" for admin record type.

 

Have you added the value 'Administrative' to the picklist casetype. If not that should be the error.

 

Thanks,

Aravind