Results 1 to 5 of 5

Thread: Custom field filter

  1. #1
    Ciscoweb is offline Junior Member
    Join Date
    Nov 2009
    Posts
    1

    Default Custom field filter

    Hi,

    do u know if it's possible to add filters on custom fields in order to visualize a custom field only if the contact is connected to a specifical option (assigned to an user etc..).
    Or is there any plugin that can add different contacts modules?

    thanks in advantage,
    cisco

  2. #2
    salesagility's Avatar
    salesagility is offline Sugar Community Member
    Join Date
    Aug 2006
    Location
    UK
    Posts
    2,379

    Default Re: Custom field filter

    You can add the custom fields you have created to the search and advanced search panels and filter results accordingly

  3. #3
    eggsurplus's Avatar
    eggsurplus is offline Sugar Community Member
    Join Date
    Dec 2005
    Location
    Minnesota
    Posts
    2,343

    Default Re: Custom field filter

    You want to hide/display a field based on some conditions? That's definitely possible but will take some technical expertise. There are some different ways of going about that with one being to add javascript to the edit/detailviewdefs.php that will set the display to block/none depending on the condition you want.

  4. #4
    gregbaskind is offline Sugar Community Member
    Join Date
    Mar 2009
    Posts
    23

    Default Re: Custom field filter

    eggsurplus,

    Can you give an example of changing javascript in this file?
    <root>/custom/modules/Opportunities/metadata/editviewdefs.php
    Not sure where to add the javascript.
    Is this the correct file?

    The problem I am trying to solve is very simple:
    I need to hide the Probability input field so that users cannot edit directly, but javascript can.
    If the user changes the Sales Stage, then Probability will be auto-populated
    (autopopulated by PROBABILITY_SCRIPT (i think, but cannot find it).

    I have tried to edit
    <root>/custom/modules/Opportunities/metadata/editviewdefs.php
    and make Probability readonly => true, but this creates null values in database>Opportunities/probability

    PROBABILITY_SCRIPT is a javascript and therefore it relies on the Probability input field being writeable in the browser UI.
    Is there a built in displayparam such as 'hidden' => 'true' or 'display' => 'none' to hide the field?
    Will I need to change the smarty template javascript?

    Greg

  5. #5
    gregbaskind is offline Sugar Community Member
    Join Date
    Mar 2009
    Posts
    23

    Talking Re: Custom field filter

    I found out how to hide fields with Javascript.
    This solves my problem. The field is still actionable by javascript, but user cannot interact.
    I copied
    /modules/Opportunities/views/view.edit.php
    to
    /custom/modules/Opportunities/views/view.edit.php

    The I added code to change the style elements of the probability field:
    This solves my problem by hiding the field when the user mouses over.
    The field reappears when the user selects a new Sales Stage.
    I know...goofy, but it IS upgrade safe and does what I need.
    It also doesn't interfere with the PROBABILITY_SCRIPT 's original purpose.

    Code:
    document.getElementsByName('probability')[0].style.display = "none";
    Code:
    $probability_script=<<<EOQ^M
            <script>^M
            prob_array = $prob_array;^M
           
            document.getElementsByName('probability')[0].onmouseover = function() {
                                document.getElementsByName('probability')[0].style.display = "none";
                              };
            document.getElementsByName('sales_stage')[0].onmouseover = function() {
                                document.getElementsByName('probability')[0].style.display = "block";
                           if(typeof(document.getElementsByName('sales_stage')[0].value) != "undefined" && prob_array[document.getElementsByName('sales_stage')[0].value]) {
                                 document.getElementsByName('probability')[0].value = prob_array[document.getElementsByName('sales_stage')[0].value];
                                }
                             };
            document.getElementsByName('sales_stage')[0].onchange = function() {
                            if(typeof(document.getElementsByName('sales_stage')[0].value) != "undefined" && prob_array[document.getElementsByName('sales_stage')[0].value]) {
                                    document.getElementsByName('probability')[0].value = prob_array[document.getElementsByName('sales_stage')[0].value];
    
                               }
                            };
            $prePopProb^M
            </script>^M

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to add a custom field to a dashlet filter?
    By mergulhao83 in forum Developer Help
    Replies: 14
    Last Post: 2010-08-25, 07:22 AM
  2. HOw to filter list in the 'relate' field
    By prajeesh in forum Help
    Replies: 1
    Last Post: 2009-07-24, 11:10 AM
  3. Filter custom 'relate' field choices?
    By bhartin in forum Help
    Replies: 0
    Last Post: 2008-07-16, 04:31 PM
  4. Replies: 6
    Last Post: 2007-08-08, 11:58 PM
  5. Replies: 0
    Last Post: 2007-01-07, 06:02 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •