Hi all,
I've added a lookup field in my marketing form, and it works fine.
Now i need to prefill it with javascript, not with a unique default value because it changes from page to page - it's a product page and i have to bind the related custom product to the lookup field.
I've tried by giving to the text field the value that gather the product that i need, but it doesn't work.
Is there a way to achieve this with the javascript API ? I mean the MsCrmMkt namespace.
Bye!
Hi all, did anybody get this to work?
We are currently facing the same issue - we able to prefill the look up field with a text value, but it does not prefill with an actual value, so it does not work.
Hi Michele!
I am currently struggling with this issue as well. What I will be doing is placing the GUID inside the lookup field which is in hidden state which would mean I will still be passing the data to dynamics on Form Submit. I am passing the Event Guid which I will be retrieving through the EventManagementAPI into the lookup.
In your situation, you will need to figure out a way to get the GUID of the product and place the data on click or redirect to that marketing form field with javascript (on form load grab it from the URL for example '?productguid=X')
If I'm able to get it working I'll post an update here with possible javascript solution as well as a step by step description.
Cheers,
Thank you Ana,
I know hot to setup fields mapping between related entities, but this is not the case.
I am not in the context of another record: the marketing form (not dynamics form, but a marketing app form) is embedded in a web page of an external site, it's not on Dynamics 365.
There is not entity context, because it's not the Dynamics app.
Best regards
Hello Michele,
The best approach here is the creation of a map field associated to the relationship. The map will populate with a dynamic value, for the record that is created in the context of another record. For example, if you qualify a Lead record, certain fields are mapped to the Account, Contact, and Opportunity from the Lead.
To create mapping between fields:
Open solution explorer.
Under Components, expand Entities, and then expand the entity you want.
Select either 1:N Relationships or N:1 Relationships.
In the main pane, in the Type list, select Mappable.
Select a mappable relationship. Then, on the Actions toolbar, select Actions, and then select Edit.
Under Related, select Mappings.
For each new mapping, on the Actions toolbar, select New.
In the Create Field Mapping dialog box, select the source field from Source Entity Fields. Select the target field from Target Entity Fields.
Select OK.
Select Save and Close to close the Relationship form.
When your customizations are complete, publish them
I just need to prefill a lookup field in a marketing form.
Let's say the lookup is binded to a lead field of type new_customentity, i need the field be prefilled with a specific entity (newcustomentity/{guid}).
Cannot use the "default value" feature, because it's not static - it depends in which landing page the form is placed.
Can you add more details to your explanation and add some screenshots?
Thank you Ana,
This is not quite my scenario.
What I mean is:
- the marketing form has a lookup field, binded to a custom lookup field (1:N) on the lead entity
- the marketing form is embedded in an external page related to a specific record of the entity
- my goal is to load the lookup with the specific entity, taken from the query string of the page, so, when the lead is generated, the lookup field is already populated
Hello Michele,
Based on your description I suggest a creation of a mapping.
This lets you set default values for a record that is created in the context of another record.
Please follow the official documentation: docs.microsoft.com/.../map-entity-fields
André Arnaud de Cal...
292,031
Super User 2025 Season 1
Martin Dráb
230,868
Most Valuable Professional
nmaenpaa
101,156