You need to sign in to do that
Don't have an account?
n1009
UnTerminated String Literal
Below is my code and , and having this"UNTERMINATED STRING LITERAL" error.I write this code in a custom button.
{!REQUIRESCRIPT("/soap/ajax/14.0/connection.js")} alert('Inside...'); var checkbox = 'False'; var prescriptionResult = sforce.connection.query("Select Id,Prescription__c.Status__c,Prescription__c.Quantity__c, Prescription__c.Balance_Prescription_Quantity__c From Prescription__c WHERE Id ='{!Prescription__c.Id}'"); var Prescriptionappt = prescriptionResult.getArray("records"); var stockRecords = sforce.connection.query("select Id,Stock__c.Quantity_received__c from Stock__c where Stock__c.Drug__c ='{!Drug__c.Id}'"); var appt = stockRecords.getArray("records"); var DrugRecords = sforce.connection.query("select Id,Drug__c.Stock_on_hand__c from Drug__c Where Id='{!Prescription__c.DrugId__c}'"); var appt1=DrugRecords.getArray("records"); var updateRecords = []; if ((Prescriptionappt[0].Status__c != "Partially collected") || (Prescriptionappt[0].Balance_Prescription_Quantity__c == null)|| (Prescriptionappt[0].Balance_Prescription_Quantity__c == 0) ||(parseFloat(appt1[0].Stock_on_hand__c))<(-Prescriptionappt[0].Balance_Prescription_Quantity__c)){ alert(' '+'cant done this functionality'); } else { for (var a=0; a<Prescriptionappt.length; a++) { if(parseFloat(appt1[0].Stock_on_hand__c) > 0){ if(parseFloat(appt1[0].Stock_on_hand__c) >= (Prescriptionappt[0].Balance_Prescription_Quantity__c)){ if(Prescriptionappt[0].Status__c == "Partially collected"){ Prescriptionappt[0].Status__c = 'Collected'; checkbox = 'True'; } } } } } try{ alert('Inside 1'); result = sforce.connection.create(newRecord); alert('inside 2'); var savePrescriptionResult = sforce.connection.update(Prescriptionappt); alert('inside 3) var saveStockResult = sforce.connection.update(appt); alert('Inside 4'); if(result[0].success == 'true'){ alert('An New Opportunity with Name was Created Successfully.'); } if (!savePrescriptionResult[0].getBoolean("success")) { alert("Error updating Status, please contact your Administrator: " + savePrescriptionResult[0]); } if (!saveStockResult[0].getBoolean("success")) { alert("Error updating Status, please contact your Administrator: " + saveStockResult[0]); } // Refresh the page window.location.reload(); } catch (err) { alert('Comes in catch'+err.description); }
Should be: