Home     |     MS SQL Server    |     MS SharePoint    |     MS Visual Studio    |     MS Certifications    |     MS CRM     |     MS Office    |     MSF


Cervo Technologies
The Right Source to Outsource

microsoft.public.crm

jscript message box


I have a bit field I created in account new_returnedinvoiceexist with values
of Yes or No.

I wanted to create a jscript onload event to alert user if
new_returnedinvoiceexist value is "Yes".

I created the following jscript but cannot get it to work:

var returnedInvoice = crmForm.all.new_returnedinvoiceexist.DataValue;

if (returnedInvoice = true)
{
alert("return");

}

else
{
;

}

I have tried many different combinations like changing true to 1 etc.  I
have checked that the field name is correct.  I have gotten the alert to
popup but was not correctly checking the field.

Help!  I know this should be very easy.

Hi,
Just a small mistake, when you need to check some condition than use two
equal to signs
if (returnedInvoice = true)     INCORRECT
if (returnedInvoice == true)   CORRECT

// WORKING CODE
var returnedInvoice = crmForm.all.new_returnedinvoiceexist.DataValue;

if (returnedInvoice == true)
{
  alert("Return");

}

else
{
  alert("Nothing");

}

--
PLEASE do click on Yes or No button if this post was helpful or not for our
feedback.

uMar Khan
Email for direct contact: imumar at gmail dot com

The comparison operator in JScript is "==", not "=" :)
So the line "if (returnedInvoice = true)", should be  "if (returnedInvoice
== true)"

Hope this helps,
Jevgenij

"Troyz" <T@discussions.microsoft.com> wrote in message

news:E058DC77-513B-48F2-93E9-A85B290AFE22@microsoft.com...

Of course!  That fixes it.  Thanks

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc