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
Smike25Smike25 

Validation for custom button using Execute JavaScript

Hello,

Looking for some assistance with a custom button i'm trying to create.  We use Conga Composer to send our sales orders and i'd like to prevent users from being able to generate the sales order they fully complete the customers billing address on the account.  I'm using Execute JavaScript trying to accomplish this, but getting the error "missing ) after arguement list.  It is probably something simple i'm missing.  Could someone take a look?
 
{!REQUIRESCRIPT("/soap/ajax/37.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/37.0/apex.js")} 

if('{!Opportunity.Billing_Information_Complete_On_Account__c} <> true'){ 
alert ("Billing information on the Account must be completed"); 
} 
else{ 
window.open(https://composer.congamerge.com 
?sessionId={!API.Session_ID} 
&serverUrl={!API.Partner_Server_URL_290} 
&id={!Opportunity.Id} 
&ReportId=00Oi0000005RNJJ?pv0={!Opportunity.Id} 
&Contactid={!Opportunity.ContactId__c} 
&EmailToId={!Opportunity.ContactId__c} 
&EmailRelatedToId={!Opportunity.Id} 
&EmailSubject=Sales+Order+For+{!Opportunity.Sales_Order_Name_Calc__c} 
&TemplateId=a09i000000I8bbH 
&EmailTemplateID=00X31000000FstC 
&EmailTemplateAttachments=1 
&FP0=1 
&DS0=0 
&DS4=1 
&DS8=0 
&SC0=1 
&SC1=Attachments 
&UF0=1'); 
}

If possible i'd like to the throw in a redirect the that particular customers account url so the user can update the correct record, but right now i'm more concerned with just having the button function correctly
Manish BhatiManish Bhati
Hey,

try the below code it will work:-
{!REQUIRESCRIPT("/soap/ajax/37.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/37.0/apex.js")} 

if('{!Opportunity.Billing_Information_Complete_On_Account__c} <> true'){ 
alert ("Billing information on the Account must be completed"); 
} 
else{ 
window.open('https://composer.congamerge.com 
?sessionId={!API.Session_ID} 
&serverUrl={!API.Partner_Server_URL_290} 
&id={!Opportunity.Id} 
&ReportId=00Oi0000005RNJJ?pv0={!Opportunity.Id} 
&Contactid={!Opportunity.ContactId__c} 
&EmailToId={!Opportunity.ContactId__c} 
&EmailRelatedToId={!Opportunity.Id} 
&EmailSubject=Sales+Order+For+{!Opportunity.Sales_Order_Name_Calc__c} 
&TemplateId=a09i000000I8bbH 
&EmailTemplateID=00X31000000FstC 
&EmailTemplateAttachments=1 
&FP0=1 
&DS0=0 
&DS4=1 
&DS8=0 
&SC0=1 
&SC1=Attachments 
&UF0=1'); 
}

Mark it as answer if it solves your problem.

Cheers.
DpeddineniDpeddineni
I have a similar issue. Were you able to resolve this?