How to ensure that the username that is auto-populated does not get replaced by another one in InfoPath - infopath

I have an approve and reject form having three views. In the first view i.e the requester's view I auto-populate the requester name by using "GetUserProfileByName". Now I also want to auto populate the name of the user who approves the form in a different view (but this view also has the requester's name)- so I was wondering if I actually use "GetUserProfileByName" again won't it change the first name too (i.e the requester's name). I don't have other accounts to test it out.
Can someone please provide a workaround to this problem
So basically I want this to happen:- For example when John enters the form his name should be auto populated in the requester's name field. And once this form is send to Michelle who approves it - the approver's name field should have been autopopulated with Michelle's name.
How can I avoid overwriting of data.
Thank you for helping

Add fields to the form data source to store the data returned from GetUserProfileByName service. Do not use default values for the values in these fields. Instead, I generally use form load rules for this - run the query, and then, if the requester field is blank, set the field to the user's name from the datasource.
When the approved view is submitted, you can take a similar approach with the approver name field - if it is blank, set it.

Related

Create a dropdown menu specific for company in AX

I would like to create a dropdown in AX form so that only the user from specific company see this field as a dropdown and other company see it as string field that user have to manually key in. I only manage to create the dropdown list based on table menu, but have no idea how to limit to specific company.
This create a problem since not all company wants dropdown and If the user key in none registered number, the system will return “ the value xxx in the field yyy is not found in the relating table zzz
How can I set the condition so that only selected company see this field as dropdown and the other company see this as string? And also where to locate the condition?
You may need to set the form control property AutoDeclaration=Yes and then dynamically change the FormStringControl.LookupButton (see here) based on the current company (curext()).
You must also decide if you have a relation on your table, whether or not you want it to be enforced (Validate=[Yes/No]). If you are allowing a free-text field input, I would imagine you would want No, but you could perform validation in the validateField or validateWrite method.
Depending on your situation, you may want to create a custom lookup with a condition.
See how to create custom lookups here - https://learn.microsoft.com/en-us/dynamicsax-2012/developer/how-to-add-a-lookup-form-to-a-control
You'll have to experiment a little, but this information should point you the right direction.
You could add two fields to your form, on with the lookup and one without. You could then use the security setup to control which users have access to which field. Note that this may not work if you have users that work in both companies that use the field with lookup and companies that use the field without lookup.

How to create a form where user gives details and also can check what he has entered on wordpress

I want to create a form on wordpress where the user will give the response and then the response is stored as csv , my problem is that i am using weforms and user are able to fill the form and response is stored also but i am not able to display the entries made by that user to himself so that he can change or view his entries later on also . I have made a website using buddy press where i need to take some data in the form so that the data is stored and the user can also check what he has entered and other members can also view his entries by going on his profile

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

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

FOSUserBundle registration form overridden - validation problems

I've modified my registration form and added a few fields (such as First name, Last name, and Organisation name).
My application will have 2 types of users - "regular" users, that will have to provide their First name and Last name, and also "organisations", that will have to provide their organisation name.
When the form is rendered, the system detects the user's "type" and only shows the form fields relevant to that user (for example: "organisations" don't get the First name and Last name fields).
The registration works fine, but there are no validation messages shown... Even if there is an error, it is not displayed.
How should I handle this?
I think it would be a better idea for you to instanciate a different form for different user level, instead of doing that in templating.
Use this:
parent::buildForm($builder, $options);
where you extend your form.

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