Milos
Milos

Reputation: 1868

Dynamics CRM fill relationship data in new form/entity according to parent form/entity

When I open some company in CRM, I have ability to add new contact from that particular company. When new contact form is open it is already filled with mapping values from that company (company name, telephone, address...).

That is a great feature. I want to implement that by myself with web resource in JavaScript. Web resource only contains buttons to the new entity. I want to open new entity (in my case to open new contact from particular company) and that new entity should have already filled input according to some custom relationship mapping which I made.

How I did that:

1) Am looking for custom relationship name (it is in configuration).

2) After that I am looking for mapping fields between two entities according to relationship.

3) Finally according to page "Set field values using parameters passed to a form" (https://msdn.microsoft.com/en-us/library/gg334375.aspx) I am passing mapping fields value from company to contact form.

Is there any easier way to do that, just to pass name of relationship and particular company and that my new contact form be automatically filed with values from company according to relationship ?

Upvotes: 1

Views: 684

Answers (1)

Henk van Boeijen
Henk van Boeijen

Reputation: 7948

You can issue an InitializeFromRequest to the server. The server returns an InitializeFromResponse holding an Entity property in which you will find the prefilled attributes.

Upvotes: 0

Related Questions