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
MikeMikeMikeMike 

Encountering a problem trying to make a button "conditional"

We presently have a Custom Button on our ASSET record that goes to a URL located on our intranet and runs an EXE to derive a field that is then put back into the ASSET record.
 
I'm trying to make that button conditional, in that criteria need to be met in order for the link to the URL to happen.  The linked-to EXE displays it's results in a separate window.  I created a '.TXT' file that has a "Sorry, you cannot......." message and wanted to display that in a pop-up window.
 
I changed the content_Source of the Custom Button from 'URL' to 'On-Click JAVA Script' and coded the script that appears below.
 
What am I doing wrong?  Running (or trying to run) this, it gives me a vague message, something about mixing scripts.
 
Please help me.  Thanks in advance,
 
Mike
 
LabelConditional NA Licensing  
S-Control NameConditional_NA_Licensing  
DescriptionTest to determine if a license exists. If not, create, else block
TypeURL  
EncodingUnicode (UTF-8)  
HTML Body

<script type="text/javascript">
//determine if a license key already exists

if ('{!Asset.Station_License_Key__c}'=='')

// go to one URL
{
location.replace('http://zugiis01/LicenseEXE/lgen.dll?ID={!Asset.Id}&USER={!User.Email}');
}
else
// go to the other URL
{
location.replace('http://zugiis01/_index.php3?path=/MR_test');
}
</script>

 

 

JakesterJakester
You're probably going to get a lot better help with this at http://developer.salesforce.com