Add the Company Name Lookup to a Marketing Forms in Customer Insights Journeys

A quick tip on how to add the ‘Company Name’ lookup on to a contact based Marketing form in Realtime marketing featuring a CopyPasta™ HTML snippet.

I was enjoying tinkering with the long awaited form prefill feature for Forms in Customer Insights Journeys. When I realised I couldn’t add the Company Name/Account Name lookup field on to a contact form. It works fine for Lead forms with the Parent Contact/Parent Account but of course our polymorphic friend the ‘Customer’ lookup strikes again. The closest you can find is the accountidname and accountidyominame or parentcustomeridname and parentcustomeridtominame. But that doesn’t mean you can’t use it!

Update the Marketing Services User Extensible Role permissions for Contact and Account

We need to make sure the Marketing Services User Extensible Role has read permissions on Account and Contact, although the lookup we are adding will be filtered on Accounts, the Customer lookup references Account and Contact so if you do not add read permissions you will have issues publishing the form.

Edit the form HTML

Now you can open your Form in Customer Insights Journeys which has a target audience of Contact. Select ‘Edit’ if the form is already published. Open the HTML window. Use the ‘Format Document’ button to format the HTML in a way that’s easier to read. Identify a spot between two fields on your form indicated by </div> and <div class=… (it doesn’t have to be in the right spot on the form for this, but you must put it in between existing field so as to not break the form HTML) and copy paste (CopyPasta™) the html snippet below into the form.

<div class="lookupFormFieldBlock"
  data-editorblocktype="LookupFormField"
  data-targetproperty="parentcustomerid"  
  data-lookuptargets="[{"LogicalName":"account","PrimarySavedQueryId":"00000000-0000-0000-00aa-000010001002","PrimaryNameAttribute":"name"}]"
  data-publicvisibility="true">
  <label title="Company Name" for="b7e5fe1e-ec83-44df-b29c-b16b990fa4f8">Company Name</label>
  <input id="b7e5fe1e-ec83-44df-b29c-b16b990fa4f8" type="text" name="parentcustomerid" placeholder="Company Name" title="Company Name" list="list-b7e5fe1e-ec83-44df-b29c-b16b990fa4f8">
  <datalist id="list-b7e5fe1e-ec83-44df-b29c-b16b990fa4f8"></datalist>
</div>

Close the HTML editor and select the ‘Company Name’ field now showing on your form. You may need to configure the Account Filter/Attribute section according to your set up but thats pretty much it!

Note; if you get issues with saving due to an error about not acknowledging the data as publicly accessible you may need to toggle the 'Make lookup data publicly viewable' to off, save/refresh and then turn it back on.

Done.

Health warning on using the Account lookup on a marketing form

As shown on the lookup properties ‘All values within this lookup will be available to anyone that sees this form. Ensure that sensitive data is not exposed to the public.’ so if you are using this field for data entry, please filter wisely as this is creating a peek into your database of accounts which could be sensitive data. I would not recommend you use this for data entry on a form, but it is great to use as a read only field on a prefill enabled form.

PS. the same issue happens for some other lookup fields such as ‘Owner’, but a similar approach can used as shown above to fix that.

Previous
Previous

Make Forms in Customer Insights Journeys a little bit more beautiful

Next
Next

Retrieve Member Data from Customer Insights - Journeys Segments in Power Automate