Make relationship filed required

Hi All

I am wandering how I can make a field required, this is a rationship field and cant see it in studio. 

As its not in studio i was going to write a vardef file as add the argument 

'required' => 'true',

the problem is i don't know the field name to then target with a vardef. I know the data is stored in  p_product_s_serialnumber_1 table, field p_product_s_serialnumber_1p_product_ida

Parents
  • Hi John,
    Normally in SugarCRM one-to-one relationships are by definition mandatory, but if this is not the case, I can suggest you override the attributes of your field. In the path: <root sugar>/custom/Extension/modules/<your custom module>/Ext/Vardefs you will find some files with the name in this syntax: sugarfield_category_id.php
    If you open one of them you will notice how the attributes are written in that file, just add the "required" => true that precisely in that way indicates that a field is mandatory.
    If your custom module is missing, you can check other modules.

    Regards.

  • Hi & ,

    I actually work with John and had the same requirement for another module while John was very inconsiderately on holiday Wink...  he returned this week and only yesterday we revisted this so I could learn the same.

    We have a one-to-many relationship from Warehouse to RMA. So one warehouse can have many RMA's.   I need to make the Warehouse field on the RMA Record 'Required':

    This location and file (file already existed - not sure if yours will Michelle?):

    Then in the file as Mauricio explained > just add the "required" => true

    *I first added it to the middle array but after Quick Repair & Rebuild (QRR) it was still not required?

    I then added to all 3 arrays and it works.  Don't forget QRR, and I suspect your browser cache can effect whether you se the change or not - but note that I am woking in a local dev instance of Ent v10.1.0 on an ubuntu vitual machine.

    I then did the same in 2 other modules for the warehouse relationship field and all test fine in my dev environment so far.

    Hopefully this helps you Michelle...  it is the reply I could not find last week!

    Best regards,

    Luke.

  • Hi

    You are O'right!, You can edit the vardefs file too, in the same route on VARDEFS folder. That´s rigth!. Your SugarCRM environment and Ubuntu VM, shouldn´t be a trouble. Just don´t forget QRR and cache clean, you can drop the cache content folder (.../<sugarcrmfolder>/cache/...), just the content and then QRR or just refresh the page. Edit the VARDEFS file always going to require QRR and may be just may be, close your session and start again.

    Regards.

Reply Children
No Data