I was looking for a solution where I'll populate the value from one list and display it to the another list. I have now got some code but not sure how use it.
I have to now use some c# code into page source of custom newform of a list. This code will actually retrieve the user information and update to the field in the custom newform in the list.
Following C# code I want to use in newform page source using sharepoint designer
SPSite _site = SPContext.Current.Site;
ServerContext serverContext = ServerContext.GetContext(_site);
UserProfileManager myUserProfile = new UserProfileManager(serverContext);
UserProfile currentUserProfile = myUserProfile .GetUserProfile(System.Web.HttpContext.Current.User.Identity.Name);
string departmentName = (string)currentUserProfile["department"].Value;
string managerName = (string)currentUserProfile["manager"].Value;
_site.RootWeb.Dispose();
_site.Dispose();
Please help me to get this work.
SharePoint Designer removes various types of code, including all C#, in order to prevent vulnerabilities from accidentally being introduced. To use your C# code you will need to create and deploy a solution package with VIsual Studio. Instead, your best bet is probably to use JavaScript. Here is documentation for 2013, here is a utility to simplify retrieving the data in 2010, and here is some code that will get you very close to what you're trying to do.
Copy of the code in case that link dies: