I have built a confiform and now I want to autopopulate data in some field by using my database by seeing which user is logged in for e.g. , I would not want the user to enter his name and instead get his name by using the current logged in user. Please tell me how to go forward with this.
Readonly should work. I have a form with a field called lastEditedBy that is a readonly and it populates the current user when the entry is created or edited. The ConfiForms documentation link is below. It is on that page. Do a page search for [user.fullName] and you should find it. Second link is also a good one for knowing how to access a field and its properties.
The answer depends on your goal for wanting to auto-populate the field.
If the goal is to auto-populate the field so that the user cannot override the value (a read-only field), then define the field as either a Calculated field-type, or a Formula. The difference is that a Calculated field is populated once at registration time, and a Formula is re-calculated every time the user updates the record.
If the goal is that the field is auto-populated with a default value, which the user can then override, then yes, Davin's answer is correct -- you can configure the Registration Controls macro to pre-populate one or multiple fields at registration time. However, if you display the Registration Controls in several places (e.g. on different pages), then you need to remember to configure the Registration Controls each time.
An alternative is to add a Field Definition Rule in the form itself. I believe the trick is to give it the Condition id:[empty], which only executes at registration time (because that's the only time the id is empty). The advantage here is that this is defined in the form itself, rather than in the Registration Controls, which may be one less thing to worry about if you're putting Registration Controls in several places (like different pages).
These last two alternatives are explained on https://wiki.vertuna.com/display/TEST/Form+with+default+values+set+by+Field+def+rules+and+by+registration+control
Finally, if your goal is to auto-populate a field for multiple records that have already been created -- e.g. if you add a field later, after people have already entered data -- then you need to run the REST API update.action to batch-update the field on multiple records. This is necessary even for Calculated or Formula fields, as those only get calculated at registration time, or when the user updates the record. The caveat I would add is to test this on test data first. I've found that the REST API is very reliable, but if you make a mistake in the syntax, you could end up overriding some data you want to keep.
The REST API is described on https://wiki.vertuna.com/display/CONFIFORMS/REST+API
It’s been great to hear from fellow users over the last few weeks about the best tips and fun moments you’ve had working on Confluence since the transition to working remote. I’d love to keep the c...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events