Hi all,
I have a requirement where I need to ask the user to select contact person if potential customer selected is an account on Quote form.
The printed quote needs to have potential customer as (Account name or contact name) and Contact person as contact person of the account.
Is this possible?
Thanks,
Hi Aarnav,
Some details need to be confirmed:
1. Is the Contact Person your custom field?
2. The user should select the contact which is related to the account.(Not all contacts, right?)
Hi Steve,
Contact person doesn't exist yet. Having this information is a requirement. I was wondering if Dynamics already has OOB feature to store contact person.
I am now thinking of creating a new custom field to store contact person in Quote eneity.
Yes, your question #2 is correct. I believe this can be achived using business rule.
Thanks
How can we find out if user selected Account or contact as potential customer?
I managed to fullfil the requirement by creating a lookup (type contact) field in Quote enity and using Javascript. I am calling tthe function on form load and potential customer (costomerid) on change.
function ShowHideContactPersonField(executionContext) { var formContext = executionContext.getFormContext(); // get formContext
function ShowHideContactPersonField(executionContext) {
var formContext = executionContext.getFormContext(); // get formContext
var lookup = new Array(); lookup = formContext.getAttribute("customerid").getValue(); if (lookup != null) { var id = lookup[0].id; var entityType = lookup[0].entityType; }
var lookup = new Array();
lookup = formContext.getAttribute("customerid").getValue();
if (lookup != null) {
var id = lookup[0].id;
var entityType = lookup[0].entityType;
}
if (entityType == "account") { //show contact person field Xrm.Page.getControl("bp_contact_person").setVisible(true); } else { Xrm.Page.getControl("bp_contact_person").setVisible(false); formContext.getAttribute("bp_contact_person").setValue(null); }
if (entityType == "account") {
//show contact person field
Xrm.Page.getControl("bp_contact_person").setVisible(true);
} else {
Xrm.Page.getControl("bp_contact_person").setVisible(false);
formContext.getAttribute("bp_contact_person").setValue(null);
Hello Aarnav,
Still little confusion, can you clear the below points.
1. End user can select the account or contact on the same lookup correct? that means it is multi entity lookup?
2. And if user is selecting the account then you will show the contact person field on the form correct ? else you will hide the field because in the main field user has selected the contact rather than the account ?
Thank you,
Amit Katariya
Yes that's exactly what my code does
so what you want to implement ? if your code is working then
Although there is a contact field on the Quote entity, but it could not be added to the form.
So you need to create a new lookup field related to Contact entity.
Then add to the Quote form:
About how to find out if user selected Account or contact as potential customer, you could achieve this by JS code in which you could get lookup field's entity type and set Contact Person field required.
Reference:
https://docs.microsoft.com/en-us/power-apps/developer/model-driven-apps/clientapi/reference/formcontext-data-entity/getentityreference
https://docs.microsoft.com/en-us/power-apps/developer/model-driven-apps/clientapi/reference/attributes/setrequiredlevel
About how to only select the related contacts, you could set 'Related Records Filtering' to do this.
Special field properties in Dynamics 365 Customer Engagement (on-premises) | Microsoft Docs
How to Filter Lookups Without Custom Code in Dynamics 365 Customer Engagement (arbelatech.com)
This is what exactly I have done. Please see my reply above.
I am marking your answer and accepted answer because you guided me to that direction.
Just setting up quotes - orders - invoices from oppty and I have no issue adding custom field and mapping from oppty to quote - quote to order - order to invoice. However, the contact, account info is not clear which way D365 wants us to handle to me. Really I just want it to work out of box or as close knowing future updates may fix these things so I am thinking I want Potential Customer to always be contact - reason is that I believe this is the default field pulled when you email a quote.I have a question on optimal setup to link accounts, contacts to quote from opportunity.Potential customer just seems strange to use at all but I believe it is what is pulled by default when sending a quote via email. 1. If logic is correct, how best to make potential customer always the contact (e.g. is that sound to force this field to be only one or other so we can always get both?)2. Add custom lookup for the account is this mapping oppty to quote I believe and then it will fill upon quote creation. 3. I do want both contact and account on the quote XML pdf so I assume that the custom account field will show up, I have potential contact already as a field4. Reporting consideration - I just want to be able to run reports on quotes, orders, invoices relating account and/or contact - do I need to map all through like I did with custom fields or relationships exist? I haven't seen if there is any relations needed for reporting quotes, orders or invoices relating to the oppty contact or account to consider or if that will work in reports, etc.
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Rishabh Kanaskar 235
MVP-Daniyal Khaleel 175
Tom_Gioielli 156 Super User 2025 Season 2