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.
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.
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.
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.
Daivat Vartak (v-9d...
225
Super User 2025 Season 1
Eugen Podkorytov
106
Muhammad Shahzad Sh...
106
Most Valuable Professional