Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

How to access a field in another entity from current entity?

(0) ShareShare
ReportReport
Posted on by 10

Hello everyone,

I am new to Dynamics I have a task to do but due to my insufficient experience, I am finding it hard to do. Here is the situation.

I have 2 entities -> Contact and Invoice. On the Invoice entity, I have a field named 'Payment Terms' -> this field must be 'read-only' and the value must be taken from another field, this time in the Contract entity.

How can I take the value for 'Payment Terms' from the Contract entity, while I am currently customizing the Invoice entity?

My Team Leader suggested using a plugin to do that and I've tried to come up with something for days, but I am facing the same problem in Visual Studio as well. I am clueless how to get access to Contract from the current entity context.

I've also thought of a Business rule, however I read it is impossible to do.

Any suggestion is much appreciated. Thank you for your time.

  • Verified answer
    Mahendar Pal Profile Picture
    45,095 on at
    RE: How to access a field in another entity from current entity?

    Ok, thank for provide more details.

    As Contract and Invoice is having 1:N relationship, so when invoice is created you will be having contract lookup set on invoice form, so some possible options are

    If user creates invoice from the Contract, you can add system mapping from the contract and invoice relationship to copy this field value from Contract to invoice.

    You can refer from here

    docs.microsoft.com/.../map-entity-fields

    When user creates invoice directly (not from contract), you can using following options

    1. Write a pre create/update plugin on the invoice where you can check if contract id is present (means contract lookup is filled), get contract id from there query paymentterms and set the same in the invoice payment term field.

    2. You can have this using workflow as well, run workflow on create and on change of the contract, set payment term field from the contract based on the lookup.

    3. Write js onchange of the contract lookup, and onsave of the entity form to get payment term field from contract and set it in the inovice.

  • IvoKostov Profile Picture
    10 on at
    RE: How to access a field in another entity from current entity?

    Hello Mehender,

    I apologize for this silly mistake. I want to get it from ContRact.

    The relationship between Contract and Invoice is 1:N and also invoices are sent to the contract owner once a month.

    I hope I answered your question.

  • Mahendar Pal Profile Picture
    45,095 on at
    RE: How to access a field in another entity from current entity?

    Hi,

    First can you confirm you want to get it from Contact or Contract

    "I have 2 entities -> Contact and Invoice. On the Invoice entity, I have a field named 'Payment Terms' -> this field must be 'read-only' and the value must be taken from another field, this time in the Contract entity."

    As first you have mentioned Contact and then later you are using contract.

    Can you provide details how these entities are related and what is the use case, so that we can suggest you on this.

    Let me know.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Daivat Vartak (v-9davar) Profile Picture

Daivat Vartak (v-9d... 225 Super User 2025 Season 1

#2
Eugen Podkorytov Profile Picture

Eugen Podkorytov 106

#2
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 106 Most Valuable Professional

Overall leaderboard

Product updates

Dynamics 365 release plans