Unable to fetch description for entitlement

Which IIQ version are you inquiring about?

IdentityIQ 8.3p2

Share all details about your problem, including any error messages you may have received.

Hello All,

Below provided fields are present in my form to fetch entitlement for specific application and description of that entitlement, but I’m unable to fetch description , when i try to log its getting null, is this wrong way to fetch description ? please help me on this.

image

Hi @DharshiniB

Please ensure that the variable ‘entitlement’ holds the correct value by printing $(entitlement) and verifying it is not null.

It appears you are using context.getObject(), which retrieves an object based on its ID or name, but not its value. Therefore, this method is not suitable for your needs.

Instead, you can use the following code to obtain the ManagedAttribute object:

Approach 1:

QueryOptions options = new QueryOptions();
options.addFilter(Filter.eq("value", $(entitlement)));		

List maList = context.getObjects(ManagedAttribute.class, options);			
if(Util.nullSafeSize(maList) > 0) {				
	ManagedAttribute ma = maList.get(0);				
}

Approach 2:

ManagedAttributer.get(context, "<application name>", "<ent_attribute_name>", "ent_value");

Approach 3: If you need to retrieve descriptions from attributes, you can use a persistent query instead of getting ManagedAttribute object.

QueryOptions options = new QueryOptions();
options.addFilter(Filter.eq("value", $(entitlement)));
		
String description = "";
Iterator<Object[]> it = context.search(ManagedAttribute.class, options, "attributes");

while(it != null && it.hasNext()) {	
	Object[] obj = it.next();
	Attributes attrs = (Attributes) obj[0];
	description = (String) attrs.get("description");
	if(Util.isNotNullOrEmpty(description)) {
		break;
	}	
}

Hi @DharshiniB
If you are trying to get System descriptions which are available in standard properties of a ManagedAttribute,
Instead of using String groupDetails = attr.getString("description");
use the below
String groupDetails = (attr.get("sysDescriptions")).get("en_US");

ManagedAttribute has a direct method to retrieve SysDescriptions. In your case you can use the below
mat.getDescription("en_US");

Hi Arpitha,

Thanks for your response, but I’m not sure why entitlement is coming as null in next field that is description. i tried to log the value, but its coming as null.

Hi @Siddu7183 ,

Thank you for response, since entitlement is coming as null, I’m unable to fetch description with this method.

Can you share your form xml

form.xml (5.0 KB)

Can you try by importing this form.

form.xml (5.1 KB)

Hi Arpitha,
Have you made any other changes in form except group description field?

Yep, added postBack on field entitlement and dynamic on groupDescription.

Is it working ?

No, still entitlement is null.

is there any way to fetch description in same entitlement field?

I just replaced ‘access’ with ‘entitlement’ and remove AllowedValues entry on ‘entitlement’

Can you try importing updated form and test it out.
form.xml (4.8 KB)

No Still not working!

form.xml (5.2 KB)

Can you import this and test it out ?

I could able to test in my local.

If it worked, I would suggest you to add application name and entitlement attribute name in ManagedAttribute Filter.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.