+ Start a Discussion
Karthik keyanKarthik keyan 

undefined identifier in javascript program

i have developed the javascript to check some if condition and execute some variable assignment,but i have  got undefined identifier as error message in the screen,please check this  error messages for that javascript,i have tried out that which cant able to figure out.

var currentUser = "{!$User.Id}"; 
var profileId = "{!$Profile.Id}"; 
if(ISPICKVAL(!ITPR__c.Status__c, 'All Digital Initials Obtained') 
and ('{!ITPR__c.Wave1_Approved__c == True}' || '{!ITPR__c.Wave2_Approved__c == True}') 
and ('{profileId}' == '{!$Label.ITPR_Finance_Admin}' || '{profileId}' == '{!$Label.ITSES_Legal_Business_Administrator}' || '{profileId}' == '{!$Label.ITSES_Procurement_Business_Administrator}' 
|| '{profileId}' == '{!$Label.ITSES_VendorGovernance_Business_Administrator}'|| '{profileId}' == '{!$Label.ITPR_System_Admin}' || '{currentUser}' == '{!ITPR__c.Primary_Assignee__c}' || '{currentUser}' == '{!ITPR__c.Finance_Assignee__c}')) 

var answer=confirm("Are you sure, you want to add Additional Approvers?"); 
if (answer==true) 

var c = new sforce.SObject("ITPR__c"); 
c.Do_you_want_additional_approver__c = True; 
c.Status__c = 'In Approvals'; 
result = sforce.connection.update([c]); 


alert ("You are not eligible to add additional approvers."); 
its difficult to track some things like this...So better put an alert for each line of the code and check where it is breaking the flow. If this not works remove the entire code add one one line of code then save and run, so that you can easily understand which line is wrong...