Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Auto-update a field in edit mode from other field contents

  1. #1
    richardhakim is offline Member
    Join Date
    Nov 2006
    Posts
    6

    Default Auto-update a field in edit mode from other field contents

    Hi,

    I have a particular field in the Projects tab that I want to have the value auto-determined based on content in other fields. Is this possible?

    To be more specific, I have these three new fields for Project:
    - location (drop down)
    - program (drop down)
    - date

    When these three fields are set, I want the name field to auto set itself to the formula "Location - Date - Program".

    Even better, I would like to prevent the user from modifying the name field.

    This seems like a pretty standard CRM software function. I have seen this in Siebel....Is this possible with Sugar?


    Thank you

  2. #2
    Angel's Avatar
    Angel is offline Sugar Community Member
    Join Date
    Jul 2005
    Location
    Los Angeles
    Posts
    4,813

    Default Re: Auto-update a field in edit mode from other field contents

    Quote Originally Posted by richardhakim

    When these three fields are set, I want the name field to auto set itself to the formula "Location - Date - Program".

    Even better, I would like to prevent the user from modifying the name field.

    This seems like a pretty standard CRM software function. I have seen this in Siebel....Is this possible with Sugar?
    Yes, it is possible to do both of these things via some JavaScript additions to the Edit page in question.
    Regards,

    Angel Magaņa
    Co-Author: Implementing SugarCRM 5.x (Packt Publishing -- Sept. 2010)
    Blog: http://cheleguanaco.blogspot.com.
    Twitter: @cheleguanaco.

    ________
    | Projects: |_____________________________________
    |
    | CandyWrapper (.NET Wrapper for SugarCRM SOAP API). Source now available on GitHub!
    | GoldMine to SugarCRM Express Conversion. Latest: 1.0.1.7 (Nov. 3, 2009)
    | CRM SkyDialer (Skype Integration). Latest: 1.0.2 (Feb. 17, 2010)
    | Round Robin Leads Assignment
    | Phone Number Formatter
    | CaseTwit (Twitter Integration)
    ______________________________________________

  3. #3
    leenwebb is offline Sugar Community Member
    Join Date
    Nov 2006
    Location
    New Hampshire
    Posts
    77

    Default Re: Auto-update a field in edit mode from other field contents

    Hi Angel,
    Do you have a sample EditView.php file I could look at? I've been working on this for a while now, and I can't figure out where to put the javascript so that it'll show up in the right place in the form.

    I can do it by editing the EditView.html file directly, but that file gets overwritten by Studio, so I'd like to find a way to put the HTML/js in the php page so I can still use studio for things other than my js-affected fields.

    Thanks!
    Eileen

  4. #4
    simple is offline Sugar Community Member
    Join Date
    Jul 2005
    Posts
    259

    Default Re: Auto-update a field in edit mode from other field contents

    Hi Eileen

    I can do it by editing the EditView.html file directly, but that file gets overwritten by Studio
    In which file did you put the javascript code? We've added js code to Contacts/EditView.html. A function and an onchange event handler for one of the custom input fields. Our custom js code retains in the file even if we move fields with Studio.

    Do you know after what Studio actions your custom code gets removed?

    Do you use Sugar 4.5? Did you add your custom code to custom/working/modules/Projects/EditView.html? If this file exists you would have to add your custom js code to this file, then go to Studio, select the EditView and (re-)Save and Publish the file. That's at least how it works here.
    Cheers Pascal
    Simplicity GmbH

  5. #5
    Angel's Avatar
    Angel is offline Sugar Community Member
    Join Date
    Jul 2005
    Location
    Los Angeles
    Posts
    4,813

    Default Re: Auto-update a field in edit mode from other field contents

    Hi Eileen,

    No, sorry, I don't have any PHP based samples.
    Regards,

    Angel Magaņa
    Co-Author: Implementing SugarCRM 5.x (Packt Publishing -- Sept. 2010)
    Blog: http://cheleguanaco.blogspot.com.
    Twitter: @cheleguanaco.

    ________
    | Projects: |_____________________________________
    |
    | CandyWrapper (.NET Wrapper for SugarCRM SOAP API). Source now available on GitHub!
    | GoldMine to SugarCRM Express Conversion. Latest: 1.0.1.7 (Nov. 3, 2009)
    | CRM SkyDialer (Skype Integration). Latest: 1.0.2 (Feb. 17, 2010)
    | Round Robin Leads Assignment
    | Phone Number Formatter
    | CaseTwit (Twitter Integration)
    ______________________________________________

  6. #6
    leenwebb is offline Sugar Community Member
    Join Date
    Nov 2006
    Location
    New Hampshire
    Posts
    77

    Default Re: Auto-update a field in edit mode from other field contents

    I have added it to EditView.html (in Calls), and it appears that it gets overwritten after I do "Save and Publish" in Studio. I am using 4.5.0e, but if yours does not overwrite, then I will play around with it some more to see if I can get the same behavior in mine.

    Thanks
    Eileen

  7. #7
    sagarladdha is offline Sugar Community Member
    Join Date
    Oct 2006
    Posts
    70

    Default Re: Auto-update a field in edit mode from other field contents

    Quote Originally Posted by leenwebb
    Hi Angel,
    Do you have a sample EditView.php file I could look at? I've been working on this for a while now, and I can't figure out where to put the javascript so that it'll show up in the right place in the form.

    I can do it by editing the EditView.html file directly, but that file gets overwritten by Studio, so I'd like to find a way to put the HTML/js in the php page so I can still use studio for things other than my js-affected fields.

    Thanks!
    Eileen
    Hi Eileen,

    I faced the problem of my custom code getting overwritten after I clicked Save and Publish. So here is what worked for me:

    When changing EditView.html or DetailView.html, do not change the one in your respective module folder. Instead, go to the following location:

    custom -> working -> module_name

    Here in this folder, you can again see the EditView and DetailView .html files. Make your changes in these. After you are done with the changes, now without testing your changes directly go to Studio and then click Save and Publish in the respective views.

    Test now. It worked for me. Hope it works for you too.

  8. #8
    leenwebb is offline Sugar Community Member
    Join Date
    Nov 2006
    Location
    New Hampshire
    Posts
    77

    Default Re: Auto-update a field in edit mode from other field contents

    Hi Sagar,
    That worked perfectly! My form is now fully java-scripted. Thank you!

    Eileen

  9. #9
    atheimer98 is offline Sugar Community Member
    Join Date
    Dec 2005
    Posts
    202

    Default Re: Auto-update a field in edit mode from other field contents

    Could you share the javascript that you used to make this happen? I have a similar situation i'm trying to solve.
    Thanks!

  10. #10
    Angel's Avatar
    Angel is offline Sugar Community Member
    Join Date
    Jul 2005
    Location
    Los Angeles
    Posts
    4,813

    Default Re: Auto-update a field in edit mode from other field contents

    Quote Originally Posted by sagarladdha
    Hi Eileen,

    I faced the problem of my custom code getting overwritten after I clicked Save and Publish. So here is what worked for me:

    When changing EditView.html or DetailView.html, do not change the one in your respective module folder. Instead, go to the following location:

    custom -> working -> module_name

    Here in this folder, you can again see the EditView and DetailView .html files. Make your changes in these. After you are done with the changes, now without testing your changes directly go to Studio and then click Save and Publish in the respective views.

    Test now. It worked for me. Hope it works for you too.
    Great tip. Thanks!
    Regards,

    Angel Magaņa
    Co-Author: Implementing SugarCRM 5.x (Packt Publishing -- Sept. 2010)
    Blog: http://cheleguanaco.blogspot.com.
    Twitter: @cheleguanaco.

    ________
    | Projects: |_____________________________________
    |
    | CandyWrapper (.NET Wrapper for SugarCRM SOAP API). Source now available on GitHub!
    | GoldMine to SugarCRM Express Conversion. Latest: 1.0.1.7 (Nov. 3, 2009)
    | CRM SkyDialer (Skype Integration). Latest: 1.0.2 (Feb. 17, 2010)
    | Round Robin Leads Assignment
    | Phone Number Formatter
    | CaseTwit (Twitter Integration)
    ______________________________________________

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

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

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
  •