Hi All, Project Requirement:
I need to create a form to update the ownership of objects from a terminated user to a new owner. Each object should display in a row with its description and a dropdown for selecting a new owner, arranged in three columns.
Issues Encountered:
- Setting the section type to “text” prevents the dropdown from displaying.
- Omitting the section type results in HTML being shown as plain text.
- I want to use JavaScript to link the dropdown selections: if the first dropdown is changed, it should apply that value to other fields, but if any field is manually changed, those values should remain.
Request for Guidance:
-
How can I properly display the objects with the dropdown?
-
How can I process the selected new owners?
Code Snippet Request: Please include example code to help illustrate the solution.
Thanks for your assistance!
Owner Update Table view.PNG
OwnerUpdate_Test.xml (12.5 KB)
Your requirement should be achieved without much hiccups. Please refer Forms 7.0 and later .
Set filed type as “comboxbox” for dropdown.
Thanks for your response @kalyankumar_saha ,
I tried that option, here I’m trying to get the multiple objects using for loop, for example User has ownership for 5 applications then all should be displayed with details and dropdown for each row.
How to get the selected values from the dropdown which is corresponding to the field.
Here is the code snippet.
//application list
Field appField = new Field();
appField.setType(Field.TYPE_BOOLEAN);
appField.setName("app_" + app.getName());
appField.setDisplayName(app.getName());
appField.setValue(false);
appField.setColumnSpan(1); // This field will take 2 columns
section.add(appField);
//dropdown
Field newOwnerField = new Field();
newOwnerField.setType(Field.TYPE_STRING);
newOwnerField.setDisplayType("combobox");
newOwnerField.setName("user_" + app.getName());
newOwnerField.setDisplayName("");
newOwnerField.setColumnSpan(1);
List allowedValues = new ArrayList();
for (Identity identity : inactiveIdentities) {
allowedValues.add(identity.getName());
}
I think if you set the type of the new owner drop down to Identity, it will autopopulate with Identities from the system and from there you can apply a filter to narrow down the list if necessary.
Thanks @ , I can show the users in the drop down but the question is Is that possible to display the dropdown to corresponding user dynamically.
Using out of the box forms you would need to pre-define a set number of potential fields. Forms still do not have the ability to dynamically populate tables. So you could set up 10 rows in your form and only display the first 3 if the user only has 3 items. However, if there are more than 10, only the first 10 would appear. I gave 10 as a limit, but that was just an arbitrary number.
You could also instantiate the workflow so that it calculates the number of items and loops through and shows the first 10, then when you hit next to transition to the next page, your workflow detects that more items need to be displayed and you show the page again (saving the previous decision) and iterate through that way. It’s not the most elegant of flows but it should be doable.
If you want it to be dynamic, you’re probably going to have to go down the plugin route and then you can handle it with javascript pretty easily.