Joget DX 8 Stable Released
The stable release for Joget DX 8 is now available, with a focus on UX and Governance.
Hi,
If you want the current user's data, use Hash Variable#CurrentUserHashVariable
If you want other users, use Hash Variable#UserHashVariable
Have you tried #currentUser.department.name#?
Good day,
Yes, I have tried the hash, #currentUser.department.name# before posting. I will get the info as shown below
Ah i see, #currentUser.department.name# is only available for enterprise edition. Since you're using community edition, you'll probably need to perform a SQL query to get the department name.
Something like :
SELECT name FROM dir_department d INNER JOIN dir_employment e ON d.organizationId = e.organizationId WHERE e.userId = #currentUser.username#
Oh no wonder, I though the enterprise edition only apply for the below attribute. Anyway, thank you for taking your time to clarified on this matter.
With the following script, I am able to get the requestor name but I am unable to get for the department. I though just changing the hash variable "#currentUser.username#" to "#user.username.department.name#" will get me the department.
import org.joget.apps.form.model.*;
import org.joget.apps.form.service.*;
import java.sql.*;
import org.apache.commons.collections.SequencedHashMap;
import java.util.*;
public FormRowSet test() {
FormRowSet f = new FormRowSet();
f.setMultiRow(true);
FormRow r1 = new FormRow();
r1.put("requestorUserName", "#currentUser.username#");
f.add(r1);
return f;
}
return test();