Fill in the text box with the current user name registered in sharepoint

I created my own list, this is actually filling out a form for the absence request request workflow. Before publishing, I discovered a flaw. The first text field is the Person or Group text field, this helps to restore the Active Directory username, but the disadvantage is that I can enter any username that I want. Example:

"User X is registered, but if he enters user Y and enters it, he may request a lack for user Y"

So, I want to hide the text box and automatically fill it with the current user.

I searched for formulas for computed text fields, but didn't find anything.

+3
source share
4 answers

Iโ€™m not sure what you didnโ€™t do here, but if you have a folk pinger that you want to fill in with the current user, hereโ€™s how to do it. Then you have to disable the control so that the user cannot change its value.

PickerEntity entity = new PickerEntity 
{ 
   Key = SPContext.Current.Web.CurrentUser.LoginName 
};

PeopleEditor.Entities.Add(entity);
PeopleEditor.UpdateEntities(PeopleEditor.Entities);
+5
source

Does it help?

SPUser user = SPContext.Current.Web.CurrentUser;
+2
source

, , "" . , .

+2

WF SharePoint, "" .

Or, hide the column using jQuery and just write it using the default value for the field as [ME]. [ME] fills the text field with the current user.

Change: . This whole thing can be solved by simply capturing what is created in the workflow. You do not even need to fix the value in the text box. SharePoint knows who created the item already. This will actually lead to a less complex form.

0
source

Source: https://habr.com/ru/post/1711289/


All Articles