Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Prepopulating a form in workspace via webservice call

Avatar

Level 3
Hi,



I am having problem prepopulating forms when user launches a process (form).



This is what I want:

1. user logs on to the workspace

2. user browse for the form they want to submit

3. user clicks on the form

4. form renders with pre-populated information (address/city/phone/etc) associated with the user that's logged on.

5. users fills out the rest of the form, then submit, done.



I got the render service working, which applies reader extension and renders to the workspace. It uses a the xfaform in the main process which uses the render service mentioned.



I also got the userslookup (ldap) process made up it should work as I have tested using the following URL, http://tsdapp13:9080/soap/services/user_lookup?wsdl, and also properly mapped.



However when I open the form, it doesn't seem like it wants to populate the fields that I set to prepopulate.



Any ideas?
7 Replies

Avatar

Level 10
The data that gets merged with the form corresponds to the Form Data paremeter of the Render PDF Form step in your render service.



What data are you passing for the data parameter of the render to pdf step in you render service?



Jasmin

Avatar

Level 3
Just the default (probably nothing), I thought I could call the web service inside the PDF/form after it's been rendered, and it would populate then?



Am I understanding this incorrectly?

Avatar

Level 10
Sorry, yes you can call the WS from the form.



Put a regular button on the form that calls the click event of the real submit button that makes the web service call. The reason is because you want that code to run server side.



So hide the button you get from the data connection. Add a new one with the following sctipt that runs server side:



WSButton.execEvent("click");



Jasmin

Avatar

Level 3
Yup, I got all those parts working~ However, my problem is... How do I pass the userid from workspace to the form to the lookup webservice?



I can manually type in a userid string on the form and click on the button to populate the fields, however I need the form to know who is logged into workspace so that the lookup/populating is done automatically per user taht's logged in.



I understand the WSButton.execEvent("click") part, but how do I bind the userid to the workspace id that's logged in.

Avatar

Level 10
Try to put the Process Fields, from Form Designer on the XDP. The render service should populate the AWS_ASSIGNED_ID with the user id.



If you can't you're only option is to prepopulate from the render service (before the form is rendered).



Jasmin

Avatar

Level 3
Hi,



Ya I tried to bind it to the process fields, but it doesn't want to populate with user id for some reason, it's always blank, i think the form needs to be actually assigned to someone or something.



So my workaround is to pre-populate the AWS_ASSIGNED_ID in render service by manually inserting it to the fomr data for now, and that seems to work for now.



Thanks for your help.