Convert Lead only if picklist on the Lead form is 'Yes'

Hi Team,
We are using CRM 4.0 Professional. I'm just wondering if its possible to set 
a condition to only convert the lead when a qualifying question on Lead form 
is selected Yes. If the value is not selected it should alert the User.

Appreciate any ideas

sharas
0
Sharas (2)
7/18/2008 2:18:27 PM
crm 35858 articles. 1 followers. Follow

4 Replies
519 Views

Similar Articles

[PageSpeed] 13

I'd recommend hiding the "Convert Lead" button until that Field =
"Yes". You'd need to search through the HTML of the Lead to find the
Button name which you will later reference in your code. To get to the
Lead's HTML code:
1.) Open up any lead in CRM and hit the F11 button twice. This'll
expose the URL.
2.) Copy it, then open a new instance of IE.
3.) Paste the URL in the Address bar. This'll open up the record
again, but outside of "Application Mode".
4.) Hit the Alt key to open the main IE Menu bar.
5.) Select "View" --> "Source" and the HTML will open in a Notepad
window.
6.) Copy this into a blank HTML file in VS2005

Now you can search for the button name ("Convert Lead...") using the
Find window. Once you find that, you'll need to look for the ElementId
tag (to the left of the button name). All CRM Action menu buttons are
prefixed with _MB. In this case, the EelementId is "_MBconvertLead".

That's the hardest part. Now you have what you need to hide the button
based on your requirements:

var myField = crmForm.all.new_[attributename].DataValue;
switch(crmForm.FormType)
{
    case 1:
    case 3:
    case 4:
    case 5:
    case 6:
        break;
    case 2:

        if(myField == [ValueThatEqualsYes])
        {
            var btConvert = "_MBconvertLead";
            var menuButton = document.getElementById(btConvert);
            if (menuButton != null)
            {
                menuButton.style.display='';
            }
        }
        else
        {
            var btConvert = "_MBconvertLead";
            var menuButton = document.getElementById(btConvert);
            if (menuButton != null)
            {
                menuButton.style.display='none';
            }
        }
        break;
}





0
MDoddio (29)
7/18/2008 3:40:31 PM
By using the OnLoad event you can create a custom OnClick function.
See the code below:

var convertLead = "_MBconvertLead";
var mnuItem = document.getElementById(convertLead);
if(mnuItem != null)
{
    document.all._MBconvertLead.onclick = function()
    {
        if(crmForm.all.[new_yourfield].DataValue != [YesValue])
        {
            var Text = "In order to convert this Lead, [YourField]"
+"\n";
            Text = Text + "must have a value of 'Yes'.";
            alert(Text);
        }
        else
        {
            window.execScript("convertLead()");
        }
    }
}

Now, keep in mind that I do not know if
window.execScript("convertLead()"); is the correct Action. You will
need to dig back into the HTML code to find the Action associated with
the Menu Button (it should have a tag with "Action=" in it. Put that
Action (with Quotes) into window.execScript(["convertLead()").
0
MDoddio (29)
7/20/2008 7:29:33 PM
Hi 

We would like to prevent our users from resolving cases if 'yes' is not 
selected in a close case picklist. The only available options in this 
picklist are 'Yes' or 'No'.

I inserted the following code in the OnLoad event for cases:
var closecase = crmForm.all.new_closecase.DataValue;
switch(crmForm.FormType)
{
case 1;
case 2;
case 3;
case 4;
case 5;
case 6;
break;
case 2;

if (closecase == 'Yes')
{
var btResolve = "_MIresolve";
var menuButton = document.getElementById(btResolve);
if (menuButton != null)
{
menuButton.style.display=";
}
}
else
{
var btResolve = "_MIresolve";
var menuButton = document.getElementById(btResolve);
if (menubutton != null)
{
menuButton.style.display = 'none';
}
}
break;
}

I received the error on page message. Not sure where I am going wrong and I 
would really appreciate some assistance.

Many Thanks
Mark



"Dodd" wrote:

> By using the OnLoad event you can create a custom OnClick function.
> See the code below:
> 
> var convertLead = "_MBconvertLead";
> var mnuItem = document.getElementById(convertLead);
> if(mnuItem != null)
> {
>     document.all._MBconvertLead.onclick = function()
>     {
>         if(crmForm.all.[new_yourfield].DataValue != [YesValue])
>         {
>             var Text = "In order to convert this Lead, [YourField]"
> +"\n";
>             Text = Text + "must have a value of 'Yes'.";
>             alert(Text);
>         }
>         else
>         {
>             window.execScript("convertLead()");
>         }
>     }
> }
> 
> Now, keep in mind that I do not know if
> window.execScript("convertLead()"); is the correct Action. You will
> need to dig back into the HTML code to find the Action associated with
> the Menu Button (it should have a tag with "Action=" in it. Put that
> Action (with Quotes) into window.execScript(["convertLead()").
> 
0
7/23/2008 12:53:01 PM
Hey Mark,

It looks like your case statments have semi-colons instead of colons.
Your menuButton.style.display=''; line had a single double quote (")
instead of 2 single quotes (' '). Not sure if this was re-formatted
when you copy/paste the code or not, but make sure that you have
single quotes. Best way to check these small details is to paste you
JScript code into a blank .js file in Visual Studio 2005. While it
can't provide Intelisense, it does provide you with basic color
formats for stuff like (' ') in Red which makes it easier to spot
minor typos in your code.

Also, If your New_CloseCase attribute is a picklist, you'll need to
reference the Integer value, not the string value. But to make things
more confusing, CRM references the Picklist's integer value as a
string, so you need to wrap the integer in double quotes. Go figure.

However, if your New_CloseCase attribute is a bit field, formatted as
a picklist, you need to use the true/false values (no quotes).

I switched around the If/Then statements a bit to remove some
redundant code. So, assuming that New_CloseCase is a picklist, with
the value "Yes" = 1 and "No" = 2, try the following:


0
MDoddio (29)
7/23/2008 2:20:13 PM
Reply:

Similar Artilces:

No Form Assistant in Quote Product Screen
While entering data in the QuoteProduct screen, no Form Assistant is available. Is it the usual feature or I need to configure something to view the Form Assistant? Also is it possible to see contact hierarchy in an account in the form of a Organisational Chart? Is their any add-on available in relation to this? ...

Form for table
Here's the problem: Access 2003, XP Pro- I have three tables that are related by primary keys. I have a table[Table QC] that has the field [EmployeeID], the data type is number--that field is linked to the autonumber primary key of the Employees Table. So far so good. I am trying to make a form that has a combo box that looks to the Employee Table to get me the drop down of the employees (Last Name, First Name). The SQL statement builds out okay, and I get the correct name config., but because the data type is a number it won't accept the data. I looked at the Northwind example and i...

Build Dynamic Query from Form
I am trying to build a dynamic Query from a Form. I keep getting an error that reads ‘Object qryFilter already exists’ I suspect it has something to do with the string of dates being passed to the Query; strDateCondition = "([Trades].[TDATE] Between [Forms]![SearchForm]![cboFrom] And [Forms]![SearchForm]![cboTo])" I am trying to add a means for a user to Query by Customer and Trader AND all records between two dates. This was working fine for Customer and Trader; when I added in the code to filter by dates I started having problems. I know the SQL will be li...

in excel how can we put formula to convert numericalfigureto word
for example : in excel i have mention 25000.00 in numerical amount , i want to know how can i convert in next colum , about word ?/; How can i put formula to make the numerical in to words like 25000 in numerical to twenty five thousands in word. There is no direct functions to convert this. For a VBA solution check out the below links http://support.microsoft.com/kb/213360 http://www.ozgrid.com/VBA/ValueToWords.htm http://www.xldynamic.com/source/xld.xlFAQ0004.html -- Jacob (MVP - Excel) "excel" wrote: > for example : > > in excel i hav...

How can I convert a timeline to be vertically oriented?
How can I convert a timeline to be vertically oriented? Microsoft says it's possible on a few web pages but I can't find instructions. Which version of Visio are you using? Randall Arnold "Sherry" <nowhere@microsoft.com> wrote in message news:ut%23cPHX1DHA.3656@TK2MSFTNGP11.phx.gbl... > How can I convert a timeline to be vertically oriented? Microsoft says it's > possible on a few web pages but I can't find instructions. > > Visio 2000 "Randall Arnold" <rgarnold@cathartis.com_> wrote in message news:#pEeMyY1DHA.1272@TK2MSFTNG...

Sum in Form Footer
Hi Folks, I've made a the following calculation in form Detail section into text box and I've called my text box "Chaussures" =Sum([Chaussures])+([aldo])+([Feet-First])+([Transit])+([Globo]), this sum calculate the sum of Units which are into these text boxes "aldo", "Feet-First", "Transit" and "Globo" and this for each line record. Now in the Form Footwear, How can I make the total of units "Chaussures" I've tried a lot of things and nothing seems to work. Your help will be much appreciated, Thankign you in advance,...

Appending in a sub form
I am creating a venue ticket tracking DB in Access '07. tblVenueEvent has info about Venue, date, time, event with a VenueEventID (key field) which is linked to tblTicketInfo which has section, seat, row, etc. I set up an entry form completing VenueEvent info with a sub form for ticket info. Some of the venues have a standard set of seats that I want to "auto populate" into the sub fom. I have set up a Venue table with the standard seats for the venue. I can set up an Append Query on the sub form, which does append the tblTicketInfo, but does not capture the VenueEven...

what is the name of a sub form download from microsoft website
i need to add a sub form to a form created in access. i tried to start the wizard but the feature is not currently installed. i try to install but it is looking for a disk for me to insert. i do not have a disk to insert. can i go to microsoft website and download the sub form feature for access? if yes, what is the name of the download. Are you sure it is not installed? Open your main form in design view. Click the Toolbox button in the menu at the top. There are two buttons at the top of the Toolbox, an Arrow and a wand. Is the Wand highlighted. If not, click on it then click on th...

convert text in excel to uppercase
Is it possible to convert all text in a workbook or on a spreadsheet to all uppercase? In VBA Editor Sub MakeUpper() Dim MySht As Worksheet, MyCell As Range For Each MySht In ThisWorkbook.Sheets For Each MyCell In MySht.UsedRange.Cells MyCell = UCase(MyCell) Next Next End Sub "elaine" wrote: > Is it possible to convert all text in a workbook or on a spreadsheet to all > uppercase? Hi see: http://www.cpearson.com/excel/case.htm -- Regards Frank Kabel Frankfurt, Germany "elaine" <elaine@discussions.microsoft.com> s...

I can no longer convert my files to pdf
I have Publisher 2003 and yesterday, my pdf menu on the top left disappeared and I can no longer convert my Publisher files to pdf. I've even uninstalled/reinstalled the Adobe Acrobat 7 and have also updated to 7.8 but still no luck. The next step was to uninstall and reinstall Publisher and still no luck. Any one know what may be the problem? Thanks. How are you trying to convert your files? When happens when you try? -- JoAnn Paules MVP Microsoft [Publisher] "darrellm" <darrellm@discussions.microsoft.com> wrote in message news:A78B7B52-981D-4FB7-8625-EAD9...

Copy data from one record to a new record on a sub form
I have a form showing patient details with a sub form displaying all associated referral details for the patient. One patient can have more than one referral and I would like to be able to copy data from some of the fields on the current referral when adding a new referral for the same patient. Is this possible? Thank you for your help I am fairly new to Access code and I am having some problem following your suggestion could you please simplify. Also some of the fields on the referral records are selected via a combo box will these fields still copy? "Klatuu" wrote: > ...

Is there a way to convert OE 03 form templates?
I have a user that has upgraded from outlook 2003 to outlook 2007 and has a form template from 2003 that is in a FDM extension. Outlook 2007 is unable to read this form. Is there a way to convert this form, or will the user just have to create a new form with their new version of outlook? Any information appreciated. Thanks, -AllenK What happens when you try to install the form? Any error message? -- Robert Sparnaaij [MVP-Outlook] Coauthor, Configuring Microsoft Outlook 2003 http://www.howto-outlook.com/ Outlook FAQ, HowTo, Downloads, Add-Ins and more http://www.ms...

converting FILETIME into two DWORDS
Hi, i want to extract date and time from a FILETIME structure into two dwords. So that the two dwords contain the date and time info in the same way in which NTFS store the file creation, modification and access date. Thanks. ...

form error
Help! I am using a command button from a subform to open form and I am getting an error. It says "the table tbleActivityNote is already opened exclusively by another user, or is already opened by the user interface and cannot be opened programically". I have this same concept on 3 other forms with now problems. THanks for any ideas. Did you bind your forms to tables or queries? You should be using queries. sue gray wrote: >Help! I am using a command button from a subform to open form and I am >getting an error. It says "the table tbleActivityNote is already...

Multiple Item Forms
Hi. I am new to your form and am struggling with the Multiple Item Forms. I want a combo box on the top that will select an id number from a table called 'SurveyA'. The multiple item form should then only display the records in a table called 'ActTravDiary' with that id number. As the ID number is changed a new group of records should be displayed in the form. I know how to initiate a change in one combo box based on another combo box (i.e. Row Source), but I cannot find a similar property for the multiple item forms. Please help. On Fri, 12 Feb 2010 21:00:2...

Routing Forms
I'd like to create a form in a public folder that a user can fill out and click submit. When they click submit, the form would go to an internal recipient who would either approve or reject it. If they reject it a notice goes back to the sender. If they approve it, it would go onto the next level for approval. Is this possible? Are there any good directions? Thanks, Glenn Same here. GroupWise has this function, and we used it heavily. I need to do some deep research on it again. Todd "Glenn" <nospam@monsonschools.com> wrote in message news:%23EajC2pkEHA.2340@T...

Set Enabled On All Controls in a Form?
I am trying to set all controls visible, unlocked, and enabled, as the baseline for disabling or locking down some fields based on other criteria. Here's what I tried, which gives me an "Invalid or unqualified reference" error: Function SetEnabledFieldsBase() Dim ctl As Control For Each ctl In Me.Controls .Enabled = True .Visible = True .Locked = False Next ctl End Function I based this on several examples that were intended to do something to all text boxes on a form. (I have never done this before, so sorry if this i...

Open Continuous form with a few lines showing
Hi I have successfully implemented a continuous form to open at a new line with RunCommand acCmdRecordsGoToNew in the Load Event However, you have to manually scroll a little to see a few of the previous records. It would be nice to see up to 5 of these previous lines on Opening the form Is there a way to modify this code to do that? Thanks Neil Change the form's underlying record source to a Top 5 query. In a query's design view, right click in a blank area, and choose properties. Set the Top Values to 5, then adjust your criteria and order by clause to ret...

CRM 4.0: Do notes carry over in lead conversion?
Hi all, I know that in CRM 3.0, when you convert a lead, you lose the notes associated with it. Is this still the case with CRM 4.0? Is there maybe a way to fix that now--mapping relationships?!? Thanks. Hi, Same is the case in CRM 4. Notes of Lead will stay with Lead after conversion to Account or contact. To move them to Account or contact, you need coding. Llugin or workflow assembly will work for you. -- uMar Khan :: MS CRM MVP Microsoft CRM Consultant Email :: imumar at gmail dot com Blog :: http://umarkhan.wordpress.com MVP :: https://mvp.support.microsoft.com/default.aspx/profil...

add GENDERCODE to leads
We implemented MS CRM some time ago, and now we come across some minor issues... one of them is: why can't we add the GENDERCODE to a lead?? is there a way to do it (easily) or can we better forget about it??? ...

How do I convert spreadsheet from Canadian $ to American $?
The Euro conversion is not doing it for me. I am working with Canadian funds and American funds. I am desperate! Assuming the Exchange rate be .70.........type that in an unused cell, say X1, then highlight it Right-click and do Copy, then select the cell(s) with the Canadian funds therein (assuming no formulas) and do Right-click > PasteSpecial > Multiply....... Vaya con Dios, Chuck, CABGx3 "Samantha" <Samantha@discussions.microsoft.com> wrote in message news:8A43A210-BA3E-4ECC-AA07-B81D3A548D73@microsoft.com... > The Euro conversion is not doing it for me. I am...

filter records in a form
I've created a form with its subform to enter tasks of employees. however I need filter records only for active employees The form has as a source, the table CARD_EMP (employee card). It has a field ST_EMP for the employee status (Active , Pasive) In the Event Form_Current I wrote DoCmd.ApplyFilter ST_EMP='A' but it doesn't work Thanks for advance Carlos -- Message posted via http://www.accessmonster.com Hi mamumi Your advice was the solution Thanks a lot Carlos -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-formscodin...

rudimentary database form maybe?
Several times a week i have a group of students penning out forms - i then spend the afternoon typing them all into a spreadsheet or a word table which i can use as a rudimentary database I'm looking for a method of using an electronic form for the students to complete directly My problem is that several students will be completing their own form/record/row simultaneously on several different (networked) computers and need these to appear as seperate records/rows I can't use Access since the company don't have it installed - but i don't mind using Word table or Excel s...

GENERATE a TEXT FILE Using INPUT from a Form ??
I need to generate a Text file using (partly) information entered by the user on a form. I already have the TEMPLATE for the text file......I need to generate a COPY of the file with the word entered by the user into the form INSERTED into the text file. The text file is actually code for a web page (will have an .htm extension). The file is simply an exact copy of an existing template with only ONE ITEM of the text changed to a word that is entered into a form by a user. Example: One line within the template file is: "We have several of these items available in BLUE." I have...

Adding button to Form, How to get the wizard?
Hello, I am adding a button to my form and I need the button to open, save or close other forms. I want the wizard to start directly after I add the button to the form. I started first time but than I have to changed someting and it is not running anymore. Can you help me? Thanks a lot Jan, When you have the form in design view goto the Toolbox toolbar and ensure that the Control Wizard (2nd button from the left) button is selected (highlighted). This button can be enabled or disabled. when enable the wizard will startup when disabled it leaves you to do all the worksetup yourself...