Kentico BizForm API - how to create that form “anonymously” from the backend with logged-in user?

Alex Sid asked on March 7, 2020 17:01

We have an existing Kentico-driven site. On top of that site, we created a user-friendly app to allow managers to enter data into Kentico database. Essentially we are using Kentico API from our backend code to creating a BizForm object in Kentico. The problem I'm facing is that when managers enter information on our site, everything is done in the context of MANAGER - and therefore Kentico updates manager's contact information with CUSTOMER information they just entered.

Here is what happens:

  1. Manager John has USER account in Kentico.
  2. He logs in into our app. We call AuthenticationHelper.AuthenticateUser() for him, and set a cookie. Every API is protected with [Autorize] attribute
  3. Then he fills in information for Susie (a customer) and we call BizFormInfoProvider.GetBizFormInfo().Insert() to create new form object in Kentico.
  4. Form is created - but John's contact info (in OM_Contact table) in Kentico is updated and becomes Susie's info.

I guess I either need to tell Kentico to create BizForm anonymously (and it will match email on the form to a contact, if exists), or I need to tell Kentico to disable automatic "matching" of form and contact - but I was not able to figure out how to do that. Or may be there is another way? Please help... what happens currently prevents us from using the app at all :(

we have Kentico 11 and use it with .net API

Recent Answers


Dmitry Bastron answered on March 7, 2020 17:43 (last edited on March 7, 2020 17:46)

It must be a Contact Mapping configured for form (refer to Kentico docs). To disable this behavior, you just need to remove this mapping from Form configuration. Or it might be enough just to untick "Override" checkbox.

0 votesVote for this answer Mark as a Correct answer

Alex Sid answered on March 7, 2020 18:13 (last edited on March 7, 2020 18:14)

thank you for the prompt answer but unfortunately that did not help. "Overwrite" was not checked but mapping was defined. So I set all fields to "(none)"

Image Text

but that still creates linked contact for user - bottom one is the contact I manually create from the backend code, and top one is what BizForm creates and links:

Image Text

Image Text

I guess I will be stripping auth cookie from the frontend call then (that would work, I tested) - but that's not a good solution as it exposes my APIs to the world. I would love to know if there is a better way to address this. Thank you.

0 votesVote for this answer Mark as a Correct answer

Dmitry Bastron answered on March 8, 2020 14:17

Hmm.. that's interesting. Have you considered / tried using ootb Kentico REST API instead of your custom to insert objects? It allows user authentication and inserting forms data as well, just use something similar to BizForm.DancingGoatMvcCoffeeSampleList as object type. It may not have side effects you outlined but I haven't tested this case to be honest.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.