Hello Stackexchange community.
I'm trying to create a button that will allow to make some calculations based on the field in Custom Object (Contract_Information__c in my case). I've written this code, but the result is the alert message with "Unexpected Identifier".
!requireScript("/soap/ajax/26.0/connection.js")}
var ContractInfoObj = new sforce.SObject("Contract_Information__c");
var account = new sforce.SObject("Account");
ContractInfoObj.id = "{!Contract_Information__c.Id}";
account.id = "{!Account.Id}";
if ("{!Account.Account_Status__c}" == "Yes")
{
if ("{!Contract_Information__c.Contract_Type__c}" == "Opt1"){
ContractInfoObj.Field1__c = ContractInfoObj.Field2__c * 0.1};}
if ("{!Contract_Information__c.Contract_Type__c}" == "Opt2"){
ContractInfoObj.Field1__c = ContractInfoObj.Field2__c * 0.2};}
var result = sforce.connection.update([ContractInfoObj]);
}
else
{
alert("Please update Account Status to "Yes");
}
Am i using the right approach to identify the custom object in this code?
I'd really appreciate any advices/comments provided!
Thanks in advance,