InfoPath - How can I read a people picker field and query AD to load additional fields related to the person in the field. - infopath

How can I read a people picker field and query AD to load additional fields related to the person in the field. Example: Employee Name; load information want to load email address, phone number. the InfoPath form is being used with Nintex Workflow and SharePoint 2010.
I have searched and have not been able to find answer.
Thanks
D

Unfortunately I don't have enough reputation points yet to leave a comment, but your question really doesn't provide enough detail. So any answer provided is going to be based on assumptions. You don't even clarify what version of InfoPath you're using.
That said, a good place to start is to create a data connection to receive data. You'll need to select the web service option and will then need to enter in the web server address. The address will probably be in the following format:
http://yourservernamehere/_vti_bin/userprofileservice.asmx?wsdl
Replace yourservernamehere with the address of your SharePoint server. Then, you'll need to select GetUserProfileByName as the operation you need. Just keep on clicking next and then finish to complete the connection.
You will then have to view the data source within InfoPath to see what fields are available and map the ones you want to the fields you want prepopulated on your form.
All this is based on my own assumptions, so I can't guarantee it will work in your scenario. Happy to assist if you still need help and are able to provide more details.

To autocomplete you can use your e-mail or phone number fields, with a new action rule. This is due to people picker fields not allowing any action rules applied to them.
The web service option mentioned in another answer unfortunately no longer works in SharePoint Online. Please use a data connection the hidden User Information List located on the stem of your SharePoint site instead.
Condition:
Use the condition DisplayName is not blank by using "Select a field or group..." in advanced view and selecting your people pickers DisplayName field
Actions:
Set a field's value
Field: User Information List data connection queryFields DisplayName of people picker
Value: your forms DisplayName of people picker
Query using a data connection: User Information List data connection
Set a field's value
Field: your forms email or phone number field
Value: data fields > Work_email / Work_phone of your data connection

Related

How to store information "per browser tab" in ASP.NET MVC?

In an MVC application I have a two pages process. On the first page we gather information that will allow us to identify which database record to update. On the second page we gather new values used to update this record. In order for this to work, we need a way to persists information between the two pages, including some record id.
I though of two way to do this and both have some problem.
Store the information in the Session object.
This works as long as the user does not open a second browser window or tab. If he does there is a risk that he'll apply the modifications to the wrong record. Suppose he opens tab 1 and complete the first step. Record id 1 is stored in the Session object. The user then open tab 2 and complete the first step. Record id 2 is then stored in the Session object overwriting record id 1. The user then come back to the first tab and complete the second step thinking he is editing record 1, but in fact he will be editing record 2.
Store the information in an hidden field on the page.
This would solve the problem solution 1 has, but it would be trivial for a ill-intentioned user to change the record id to overwrite any record.
While typing this question I just though of a third solution. That is an hybrid of theses two, but I'm not sure it's completely safe. We could store a random id in an hidden field on the page and use this to prefix the key we use to access data in the session object. I think this would work. Could this be exploited as solution 2 could?
Any other good way to securely store data "per tab" instead of "per session"?
Considering way 2 you may check security server side. If a user does not have modification rights on a specific record then server must not save it. Otherwise he/she is modifying a record that has modifications rights on it and does not matter if he/she is doing it by standard UI or hacking under it.
I think you are mixing up two things - authorization and passing data.
If user is authorized to do stuff with "another record", it's not important if he "tempers the hidden", because he is authorized to change another record as well. Nobody is going to do that intentionally. Means - you just need to check if user is authorized to do stuff in every post from the user i.e. in each controller method (and this is normal practice to always validate all user input server-side).
I would suggest you go with "hidden field".
If you want to separate info in different tabs you should use sessionStorage that differs for each open browser tab.
You can set it like this:
sessionStorage.setItem("perTabValue", "true");
Then you can get your value:
var x = sessionStorage.getItem("perTabValue");
if(x === "yourValue"){
//do anithing you want
}

MS infopath 2007

I have a form I have reated that I now need to have sent to multiple recipients through MS outlook. I have no problem creating a hard coded email address and submitting the information to my database through the Submit button, however I need to be able to adjust the email addresses on the fly or give the users the option to add email recipients. I have researched online and found that there is a built in function for this that links to the address book in outlook, however my systems admin has deactivated this feature. So any assistance on how to perform this type of function would be greatly appreciated.
I ended up going aroung the built in feature that was disabled by systems. In the email rules I selected my database table that housed both the office name and email address in the To: & Cc: fields through the function button. While in the function I selected my field named distro list and selected filter. There I built a logic that states
#Distro[#Office = #Office]
Where the first # Office is a reference to the field in the Disro List table, and the second # Office is from the main data connection. This filter is basically saying return the distro list that is present in the table when the displayed main connection Office field is equal to the Distro List Office field. Works like a champ.

Beginning ASP.NET. using login name as sql parameter

Does anyone have some code or a link as to how to create the user login name as a parameter during a sql query in ASP.NET?
Basically I want to use the default membership structure with a new field ClubID, then I want to add a new table called aspnet_Clubs which contains things such as Club Name, stadium name, Balance etc etc... and then use a relationship between ClubID and a field in the aspnet_Clubs table to tie things together.
Then when each user logs in they should see the clubs information specific to their loginID.
I know the syntax to use for the query, its getting the loginname parameter and being able to use/assign it as part of the search that is causing me the problem.
In general it is not recommended to break the default schema of the aspnetdb where the Membership data is stored. It can bring you to unexpected consequences in the future.
I had a similar question a couple of days ago, please check it here, may be you will be able to adopt something from the discussion to your situation.

CRM 2011 - Using contact data on Case form

I've installed CRM 2011 to see if I can tailor it to our business. We do repairs, I want to be able to book in a contact (client) and then a case and have the clients number and address print on the case form. All I can find are fields relevant to the case and not client, any idea on how I can select them?
To get fields from the contact onto the case form you could -
Create redundant fields on the case form for the fields that you want to port over from the contact, and then edit the mappings of the relationship from Contact to Case to map those fields to the case.
Create a web application that loads contact data and then add it to an iframe on the case form. Make it so that the web application accepts the case id in the query string of the URL so that it can look up the related contact and load its details within the web app.
Add JScript (or HTML resource in 2011) to the case form to load the contact values on the fly. You will have to use SOAP XML (or REST endpoints in 2011) messages to pull the data from the CRM service and then can inject it into the CRM case form's DOM.
Option 1 is the quickest solution but will not be realtime (only comes over when the case is first created and must be related to the contact on creation. Option 1 also adds some database redundancy.
Option 2 is the most supported realtime solution, but also requires the most work.
Option 3 is easier than option 2, but any DOM injection will likely not be supported for future releases.
EDIT
To use the mapping option, go to Settings > Customization > "Customize the System". Expand the Case item in the left hand navigation. Then click on N:1 relationships and open the relationship "incident_customer_contacts". This relationship connects the contact to its cases.
On the relationship window click on "Mappings" in the left hand navigation. This controls what fields are mapped from the case when it is created.
Click new and select the contact field from the left that you want to map to the case on the right. Repeat this for each field that you want mapped. Note that the fields need to be the same types, and if they are option sets, they will have to have the same underlying integer values for each of their options.
Now when you create a new case from a contact (or set the contact during the create), the fields should map onto the case.
Seeing as how Craig mentioned he's using CRM 2011, I felt I'd clarify that for Option 3 of Cole's suggestion, you can also use SOAP Xml against the Organization Service, or just use the REST endpoint and both will be supported. So long as you utilize CRM's Xrm.Page object to display the data on the form and don't do any other DOM manipulation, you should be fully supported.
Another Option, "Option 2b" we'll call it would be to add fields to the form for the data you want to be loaded, then add a plugin registered to the Retrieve of the case entity that would populate those fields on the fly for you. No redundancy other than the fields on the form at that point.
I would personally recommend Option 2b if possible because there will not be any lag in loading the data onto the form, and it provides for minimal data redundancy, minimal service calls, and the least amount of additional customizations.
My option is a lot easy one. All we are doing is using Dialog to create cases and in the dialog fields you can get contact detail dynamically. At the end of the form when you create new case, use this dynamic values to submit in Case form.
We get times when customer tell us that the phone number is changed since last time and this method gives you option to change customer's details on the fly and submit both in Contact Entity and Case entity at the same time.

send a mail to a user with a link

In my project i am sending a mail to the user to create a user account. I want to enable that link for the first time he/she clicks the link. if he clicks the link for more than 2 times,then it should go to custom error page.how to do this?
This depends on how the link is generated.
For example: If your link contains a username as GET-parameter, then you could simply query your database if the username is already in use. I would advise against that, because the user can easily change that GET-Parameter
I would recommend this: Your link should contain a unique identifier, most likly a hash. This hash is stored somewhere, to garantee it's uniqueness, like in the usertable of your database (a column for the hash of the registration link). That might also come handy, because you could create new user rows and already prefill them with necessary information. You could use these information upon rendering to insert text into the textboxes

Resources