Results 1 to 2 of 2

Thread: dynamic field value

  1. #1
    softy is offline Junior Member
    Join Date
    Oct 2011
    Posts
    2

    Default dynamic field value

    Hello,

    I created a module using the moduleCreator in sugarcrm 6.3.1 on my development version.

    I have two related fields. the first for country of departure and arrival of the second for country arrival and I want to fill dynamically the value of name field
    example :

    related 1 = USA Related 2 : SWISS so the name is filled automatically USA/SWISS.

    For this i have modified the file mymodule.php and add the save function like this:

    Code:
    function mymodule(){	
    		parent::mymodule_sugar();
    	}
    	
    }
    		/**Cette fonction permet de renseigner le nom du rooting dynamiquement**/
    		function save($check_notify = FALSE){
    		
    		$n=$_POST['ville_depart']."/".$_POST['ville_arrive'];
    		
    		$sql1 = "SELECT id FROM  swpv_swroutingvilles WHERE  swpv_swvilles_id_c= '".$_POST['ville_depart']."' AND swpv_swvilles_id1_c= '".$_POST['ville_depart']."'";
    		$result1 = $this->db->query($sql1);
    		$num_row = $this->db->getRowCount($result1);
    		$row1 = $this->db->fetchByAssoc($result1);
    		
    		if($num_row==0)
    		{
    		$this->name=$n
    		parent::save($check_notify);
    		}
    		else
    		{$this->id=$row1['id'];
    		$this->name=$n
    		parent::save($check_notify);
    		}
    		
    	}
    My Problem is that the save function does not works and not override the basic save function.

    thanks for your help and sorry for my english

  2. #2
    SagarCRM's Avatar
    SagarCRM is offline Sugar Community Member
    Join Date
    Oct 2011
    Location
    Mumbai, Maharashtra, India
    Posts
    111

    Default Re: dynamic field value

    hie softy,
    instead of modifying save function why dont you try updating name field in logic hook after save...
    or you can set name in edtiview and keeping name field as read only...
    --

    Thanks & Regards,

    Sagar Salunkhe
    Mumbai, Maharashtra, INDIA

    sagar.salunkhe1991@gmail.com

    ~~ IT professionals never dies, they just go Offline... ~~


    sugar development and support services:- indian.sugarbean@gmail.com

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Dynamic link in a custom field
    By vcobos in forum Help
    Replies: 1
    Last Post: 2011-10-25, 03:11 PM
  2. Replies: 1
    Last Post: 2009-09-01, 01:50 PM
  3. custom field of html type with dynamic querystring???
    By dogfuel in forum Developer Help
    Replies: 9
    Last Post: 2008-11-05, 07:05 AM
  4. Dynamic Calender input Field
    By atin in forum Help
    Replies: 4
    Last Post: 2008-05-14, 12:18 PM
  5. Bug in Dynamic Field template
    By yuri.gelman in forum Developer Help
    Replies: 3
    Last Post: 2007-03-30, 11:23 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
  •