Hi, I have a Relationship fielfin a custom module, this field is showing the Name field of the related module, where should I change so that the field will show the other link that I have it in the related module, in this case “DEMO ID” as show in the picture below:
you can modify the field using vardef extensions by editing a file. First provoke the creation of the file by
- Open Studio
- Select the module to which the field belongs
- Click “Fields”
- Click on the relate field you want to change
- Modify a non important setting, for example change the Audit box and save
This generates a file which you will find in:
You can modify the displayed field in the relate field box by adding a line like this (for and orientate yourself by the lines already present in this file):
$dictionary['<module>']['fields']['<field>']['rname'] = 'demo_id';
where demo_id is presumed to be the name of the field for “Demo ID”
Save the file and afterwards do a Admin -> Repair -> Quick Repair and Rebuild
The relate field now displays the demo id.
Hi Jan Siero,
Thanks for your your kindness to letting me know how to do it but I cannot find the relate field in the studio - related module which I want the demo_id to be shown in the field. I think the related field will nto be shown in the Field if the related field is created in the module relationship in versin 7.10.9. What I did was I created the related field in the Relationship in the module (in this case Demonstration module as the primary module) one to many, this field will be showing on the layout in the related module but not showing in the Field which I can modify a non important setting to create the file in custom/Extension/modules//Ext/Vardefs/sugarfield_.php.
Hope you may assist me again, thanks a lot.
I assumed you just created a relate field, but judging from your screenshots, you have two relationships:
[li]Event / Many to One / module1[/li]
[li]Event / One to Many / module2[/li]
To change the displayed field in the relate control, look in the following directory, where is the module in which you see the relate field you want to change:
In case you created the relationship yourself:
[li]you have a file by the name .php[/li]
[li]In this file you see the definition of three fields, one that ends with "_name[/li]
[li]In this field defintion, look for this line:
'rname' => 'name',
Modify it with (where demo_id should be the exact name of the field of the event module, you want to display)
'rname' => 'demo_id',
Afterwards to a Admin / Repair / Quick Repair and Rebuild, and you’re done.
In case you want to modify an existing relationship you didn’t create yourself, let us know
[li]The name of the parent module of relationship 1[/li]
[li]The name of the child module (the module with label “Event” with the field demo id)[/li]
[li]The name of the child module of relationship 2 (the module with the relate field you want to modify)[/li]
[li]The exact name of the field with the label Demo ID (check in studio -> your “Event” module -> fields)[/li]
Hi, I wrongly concluded that there were two relationships. Relationship nr. 1 of my previous post doesn’t exist.
That means that in case you need to modify an existing relationship you didn’t create yourself, let us know:
- The name of the parent module of relationship 2 (the module with label “Event”)
- The name of the child module of relationship 2 (the module with the relate field you want to modify)
- The exact name of the field with the label Demo ID (check in studio -> your “Event” module -> fields)