Auto Selecting first value from a Confiform dropdown

Bhalchandra Wagle November 23, 2021

I have a form with a confiform dropdown to pick a user. (which is populated from an insight object list)

Once the user is picked, I need to get their position title, however the position title is not directly linked to the user, I have to pass through 2 other insight objects.

I made all 4 values (the user, the middle 2 objects and the title) into dropdown. I want to set the value of position title (4th dropdown) automatically based on the user being picked (1st dropdown)

Currently I have it working to where once a user is picked, the second dropdown populates with a related value, when that is picked, the third dropdown populates with related value and when that is picked, the last dropdown populates the title.

What I am trying to see is if I can avoid the user having to pick values in dropdowns 2 and 3 (since there is only 1 value) and auto pick it.

Is that even doable. Or if there is any other way to do this, that is fine too.

Any ideas would be appreciated

1 comment

Bhalchandra Wagle November 23, 2021

So I gave this some more thought and here is what I am thinking I can do but cant seem to figure out how to do this

I'm thinking I will have 4 fields. The 1st will be an Insight Object Dropdown and the other 3 will be Insight Objects.

When the user selects the first object from the dropdown, I will get the second object (since it is an attribute of the selected object) , set it to the second field using Lookup and Set Insight Objects and do the same for objects 3 and 4 (since each object is an attribute of the previous one)

I can seem to the get data back though. Here is my logic to get the data

In the Insight Object ID field I put [entry.ObjectA.id] and in the Value field I set

Field 2 = [entry.Object1.Object2] (trying to get object2 which is attribute of object1)

Sorry if this is way off but Im new to Insight and Confiforms and there doesnt seem to be a whole lot of documentation on Lookup and Set Insight Objects function.

Any help would be appreciated

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 24, 2021

You can open a support ticket with us at https://wiki.vertuna.com/display/VERTUNA/Support+Request+Form so we can have a look together at your configuration

Hard to tell without seeing what you have. Generally, the "lookup and set" rules generate "change" events and that means "cascading". Unless they are configured explicitly to "not to propagate events"

Alex

Bhalchandra Wagle November 24, 2021

@Alex Medved _ConfiForms_ Thanks for the reply.

I believe I have the solution figured now, its just that I am having trouble getting the right data using the Lookup and Set Insight Object Data function and its more of a Syntax issue.

What I am trying to do is as follows

I have an Insight Object Dropdown where I pick "Object A".

I am then trying to look up Object B (which is an attribute of Object A) using the LookUp and Set Insight Data function. The issue I am running into is as follows

1) What is the value expected in the "Insight Object ID" field ? I think it is the Key of Object A but I am not sure how to get it (or if it is something other than the Key)

2) When setting the value in the Value field I want to set it as Object B. Is that possible and if so how do I get the value?

I went through the documentation but cant seem to find anything that states the syntax for  these 2 tasks (I was expecting something similar to the LookUp and Set JIRA issue function)

Is there any documentation explaining the Lookup and Set Insight Object Data function with examples?

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 24, 2021

Hi

Insight Object ID is the ID of the object type. Should be visible in the URL when you browse insight objects by type

Getting values from Insight objects is very messy, due to the structure of the REST API responses they produce (and ConfiForms  integrates with Insight using their RESt API)

This should help a bit https://wiki.vertuna.com/display/CONFIFORMS/Using+ConfiForms+apply+filter+rules+with+Insight+objects

(I hope)

Alex

Bhalchandra Wagle November 24, 2021

@Alex Medved _ConfiForms_ 

Thanks I did look that example up earlier. But that one is actually bringing back all Objects of the "Object Type" based on ID and then filtering other "Object Types" that are attributes to this one.

What I was hoping is that I can bring back a single Object based on a Key (similar to how it brings back JIRA fields using JIRA issue Key) and then get the second Object which is an attribute of the first (there should be only one since it is a 1:1 relationship).

Sounds like that may not be possible with the LookUp then unless I am misunderstanding this?

Ill try to dig in some more. Appreciate your assistance so far.

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 24, 2021

I understand what you ask, I am just trying to help you to show HOW to work with the data that is returned by Insight

and the mentioned page explains that a bit (navigation through Insight object properties)

Bhalchandra Wagle November 24, 2021

@Alex Medved _ConfiForms_ 

Thanks Alex. I did make some more progress on this. After selecting the first object from the dropdown, I was able to populate the second field (attribute object) with the value from first (right now it just seems to show the key but Im hoping thats just the display and it actually has the object in stored in there)

I will work with this a little more.

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 24, 2021

In "Lookup and set Insight Data" we do the following request from ConfiForms

/rest/insight/1.0/object/<OBJECT_ID>

If you do the same request in the browser you will get the structure back - and from that structure you can access any attributes provided by using the concepts demonstrated here https://wiki.vertuna.com/display/CONFIFORMS/Using+ConfiForms+apply+filter+rules+with+Insight+objects

Alex

Bhalchandra Wagle November 24, 2021

@Alex Medved _ConfiForms_ 

Thanks. That's what I have been looking at and I think I am able to work through the structure now.

I actually used the simple "Set Value" function on all the other 3 nested objects and extracted them after getting the first object and it seems to work.

Thanks for your help again

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 24, 2021
Bhalchandra Wagle November 24, 2021

Thanks for all your assistance. I got it working by getting the first object and then walking through the structure to get all the related objects in the hierarchy !!

One last question

In the first dropdown when the Insight objects come back I want to try and limit the values by checking the Name on the insight object against a name from a user type field that is on the form (in other words limit the insight dropdown to only have object for that user)

I tried filtering the Name attribute on the list with the FullName value of the User field but that does not seem to work.  Is there a better way to just take the FullName and search Insight to just bring back the one matching object?

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 24, 2021

Generally yes, filtering of Insight dropdowns is possible - and the link to example has been shared here few times

So, the question to answer is what Insight property you want to check against - if you can find the value and the expression, something like we have demonstrated for devices field in the tutorial

devices.attributes.objectTypeAttribute(objectTypeAttributeId=79).objectAttributeValues.referencedObject.id

Then you can check it against the current user [entry._user] (and all the properties the User object has - https://wiki.vertuna.com/display/CONFIFORMS/Accessing+field+values+and+properties#Accessingfieldvaluesandproperties-Additionalvaluesavailableinthecontext)

Bhalchandra Wagle November 25, 2021

That is what I did before asking the question but the filter doesnt seem to work. Maybe I am doing something wrong?

Here is my scenario.

My Insight Object is called Personnel

I used the Apply Filter on Field for the Dropdown with following

Actionable Field - Personnel (that is actually the Insight dropdown same name as Insight Object)

Filter - [entry.Personnel.attributes.objectTypeAttribute(objectTypeAttributeId=4772).objectAttributeValues.value]:[entry._user.fullName]

4472 is the id of Name attribute

When that did not work I also tried the below since I had read in one of your other posts that this is how you compare text

[entry.Personnel.attributes.objectTypeAttribute(objectTypeAttributeId=4772).objectAttributeValues.value]:[entry._func.asEntryRef(entry._user.fullName)] 

The dropdown comes back with No Matches found. I am expecting 1 value to come back based on the Insight Object Name matching the user FullName (Insight Object Name is Text and I assume User full Name is also Text)

If I load each of them individually to Text boxes I see the correct Full names. Only difference is one is all uppercase other has only first name and last name first letter uppercase. I didnt think case mattered?

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 25, 2021

What you have are not quite filters...

Try the following (assuming the expression is correct)

Personnel.attributes.objectTypeAttribute(objectTypeAttributeId=4772).objectAttributeValues.value:[entry._user.fullName]

or (as this is already on a field - I assume we are talking about "Apply filter on field" action rule) 

attributes.objectTypeAttribute(objectTypeAttributeId=4772).objectAttributeValues.value:[entry._user.fullName]

Alex 

Bhalchandra Wagle November 25, 2021

That worked like a charm thanks. I knew it had to be something simple.

I had a couple more questions. Sorry for bothering you so much, I have been using confiforms just for a week so trying to learn and finish stuff at work at the same time !!

In the previous case, since the filter now works and it only brings back 1 value, is it possible to somehow autoselect the value? 

Also release 2.18.14 says support has been added for the field description to be shown as a tooltip by setting a parameter. I read through the documentation but couldnt figure out which parameter to set?

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events