Announcement

Collapse
No announcement yet.

Linking other entity fields besides "Name" field

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Linking other entity fields besides "Name" field

    I have created the contracts entity from one of the tutorials and then I've linked the products to the contract so that a product can be selected for the contract. I'd also like to pull the default product pricing over to at least display on the contract. I know this is possible, but I'm not sure how/where to write this. I'm currently running Espo v4.3.1 (the newest release breaks my system and I need more time to look into it) and Advanced Pack v1.16.2.

    Ideally, the unit price of the product selected would show up on the contract but then have the option to modify the price for the contract. If I have to display the default price and then transfer it to a different field on the contract that would be fine.

    Any suggestions?

    P.S. I'm using contracts instead of quotes/invoice because I wanted each product to have a separate listing with dates associated for each product and then have each product visible on the accounts page. The quote module did not display the quote-items list, but only the name given to the quote.
    Last edited by joy11; 08-03-2017, 01:51 PM.

  • #2
    you could create other view for this link field and override 'select' function. Look at /client/src/views/fields/link.js
    The better way is to check, how quotes work.

    Comment


    • #3
      I think this was implemented in March 2017 release. I was looking for this again, so I figured I'd update this thread with what I found to possibly help someone else.

      In your entity .json file you can indicate what field to display in the link section. I've created a custom entity called Prospect Report with a many-to-one relationship with meetings. I want to display the start date of a meeting instead of the name, yet still link to the meeting record in the meeting entity from my Prospect Report.

      I've modified my custom/Espo/Custom/Resources/metadata/entityDefs/ProspectReport.json to include "foreignName" : "dateStart" to pull and display the date_start instead of name from the database.

      {
      "fields": {
      "meeting": {
      "type": "link"
      }
      },
      "links": {
      "meeting": {
      "type": "belongsTo",
      "foreign": "prospectReport",
      "entity": "Meeting",
      "foreignName" : "dateStart",
      "audited": false,
      "isCustom": true
      },

      Comment


      • #4
        With the update to 5.0.3 this no longer works. The code above will return the meeting id again. Is there a new way to accomplish this? I'd like to display the date instead of the meeting id or name.

        Comment


        • #5
          Hello
          Needed file wasn't changed since March. Also I tried and loading works good (shows not formatted start date). But only while selecting is using meeting name. Check entityDefs again

          Comment

          Working...
          X