prevent users from adding additional items


Badge +9

Hello

I have a list that should only create an item once for a user. If the user already created the item then the workflow should not create the item on the list and terminate. I am working with Nintex WF with Infopath.

My thought is that I have to query the list and look at the Created By column and if the name already exists then the workflow should not create the item. However I can't get the workflow to terminate if the user already exists.

 

Thanks!

Rency


16 replies

Badge +11

Hi Rency,

I had created a similar form with InfoPath sometime back where user was allowed to submit only once. Create a secondary data connection to this list in InfoPath.

I used GetUserProfileByName web service to get the current user account name in domainID format, saved this to field: AccName. I created another Text field in infopath - FilterAccName, the default value of which was Title of the item in the same list when AccName (Main connection) = AccName(Secondary connection). So if the user clicks on Add New item, and there is an item with his name in AccName field (FilterAccName is not blank), then he will be shown a message, that you have already submitted the item.

I hope this gives you an idea. It dint require workflow and i'm no way sure if i can do the same in Nintex form.

Let me know if you need sample form and i can attach it here.

Badge +9

Hi Kapil

This is exactly what I am looking for. Can you please add a sample for me? This is my first time attempting to use Infopath. I have been so used to using Nintex forms that Infopath seems so foreign to me happy.png

Badge +9

Do I create the connection (GetUserProfileByName) on the control or on the form?

Badge +11

I hope the list template and the InfoPath template helps. See attached. Let me know if its not clear.

I would certainly try this with Nintex Forms, but don't have bandwidth rite now. Let me know if you are able to do so with NF.

Badge +9

Hi Kapil

Thank you so much for this. I had a few quick questions,

1. the two fields UserName and FilterUserName are they hidden controls on the form?

2. Also for UserName you have the formula translate(Value[Name = "AccountName"], "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ") can you tell me the logic to this?

Your list and form are working great and I am so thankful for them happy.png.   I am trying to apply this to my list and form, but I need to understand the logic first. We don't have Nintex Forms which is why I am using InfoPath.

Badge +11

1. yes, UserName and FilterUserName are hidden as they work as calculated fields and have a default value assigned to them. They get their values when you submit the form.

2. UserName gets the account ID of the current logged in user. I added this formula to convert all the domainID formats to upper case. In some cases i found that GetUserProfileByName was showing me user accounts in different cases, for e.g. ABC est1 or abc est2 or abcTEST3. For comparison, you need all of them in the same case else I encountered an issue.

Badge +9

Hi Kapil

Thank you so much, hopefully this is my last question when creating the Data Connection did you choose Submit Data or Retrieve Data? I just want to be sure I am doing this correctly.

Thank you!!!!

Badge +11

The list data connection is retrieve type and so is the web service one.

141522_pastedImage_1.png

Badge +9

When I add First Name[UserName=UserName] to the formula field and save the [UserName=UserName] disappears. I can't get the formula to stay.

Badge +9

Got it thank you! I created the connection but now the formulas do not stick to my two textboxes. I am almost there!!!

Badge +11

Are you typing them in or selecting them from the data connections? One UserName is coming from the secondary data connection you have created from the list, the other one is coming from Main connection. This is created as a Filter on the First Name field.

141523_pastedImage_0.png

Badge +9

Hi Kapil

I was able to create a GetUserProfileByName connection , however when I create a secondary connection to the list it errors out. I can't see the error so I am not sure what is going on.

141526_pastedImage_1.png

141533_pastedImage_2.png

The SharePoint site location automatically populates however I get an error, do you have an idea why this is happening?

141534_pastedImage_3.png

Badge +11

Hi Rency,

What is the error on that pop-up? I cant see what it says. Once you hit Next on selection of source, it will populate the site as you mentioned. You click Next on that, it should list all the Lists and Libraries in that site. Then you select the one you using and click Next.

Badge +9

Hi Kapil

That is my biggest problem right now. I can't view the error either, wasn't sure if you had run into that issue.

Badge +9

I get this error when I fill out the form you created on the Test List, not sure if I am getting that same error when I try to create the connection. Not sure if it is related

141535_pastedImage_0.png

Badge +9

The error keeps getting cut off so I am trying to figure that out.

Reply