You need to sign in to do that
Don't have an account?
![Shawn Kaiser 7 Shawn Kaiser 7](https://dfc-org-production.my.site.com/img/userprofile/default_profile_45_v2.png)
button logic not working
I have a button that I have incorporated some validation rule into for fields that need to be filled in. I am having issue with the fields that are picklists. Below is the code I have but the error I am getting is:<span class="errorStyle">Error: Syntax error. Missing '}'</span>
{!REQUIRESCRIPT("/soap/ajax/42.0/connection.js")}
var isFilled = {!NOT(ISBLANK( Contact.Start_Date__c ))};
var isFilled = {!NOT(ISBLANK( Contact.Escort_Day_1__c ))};
var isFilled = {!TEXT( Contact.Preferred_Computer__c <> '' ))};
var isFilled = {!TEXT( Contact.Office_Location__c <> '' ))};
var isFilled = {!TEXT( Contact.Riskonnect_Department__c <> '' ))};
var isFilled = {!TEXT( Contact.Accounting_Department__c <> '' ))};
if( isFilled){var contactRec = new sforce.SObject( "Contact" );
var records = sforce.connection.query("SELECT Id, Onboarding_Process_Builder_Trigger__c FROM Contact Where id = '{!Contact.Id}'");
var contactRec = records.getArray('records')[0];
contactRec.Onboarding_Process_Builder_Trigger__c = {!Contact.Onboarding_Process_Builder_Trigger__c} + 1;
sforce.connection.update([contactRec]);
window.location.reload();}
else {alert( "Employment Section is required." );}
{!REQUIRESCRIPT("/soap/ajax/42.0/connection.js")}
var isFilled = {!NOT(ISBLANK( Contact.Start_Date__c ))};
var isFilled = {!NOT(ISBLANK( Contact.Escort_Day_1__c ))};
var isFilled = {!TEXT( Contact.Preferred_Computer__c <> '' ))};
var isFilled = {!TEXT( Contact.Office_Location__c <> '' ))};
var isFilled = {!TEXT( Contact.Riskonnect_Department__c <> '' ))};
var isFilled = {!TEXT( Contact.Accounting_Department__c <> '' ))};
if( isFilled){var contactRec = new sforce.SObject( "Contact" );
var records = sforce.connection.query("SELECT Id, Onboarding_Process_Builder_Trigger__c FROM Contact Where id = '{!Contact.Id}'");
var contactRec = records.getArray('records')[0];
contactRec.Onboarding_Process_Builder_Trigger__c = {!Contact.Onboarding_Process_Builder_Trigger__c} + 1;
sforce.connection.update([contactRec]);
window.location.reload();}
else {alert( "Employment Section is required." );}
You have an extra parentheses in these lines:
var isFilled = {!TEXT( Contact.Preferred_Computer__c <> '' ))};
I tried to remove that extra parentheses and it worked for me.
Thanks!