PX script fails to create new item in configuration management due to missing attribute mapping in Agile 9.3.4

We’re running into a critical issue with our PX script that’s supposed to automate item creation in configuration management. The script worked fine in our test environment but started throwing NullPointerException in production after upgrading to 9.3.4.

The error occurs specifically when trying to create items with custom attributes. Here’s the relevant code section:

IItem newItem = (IItem)session.createObject(itemSubtype, itemNumber);
newItem.setValue(attributeId, attributeValue);
session.save(newItem);

The exception happens at the setValue() line. We’ve verified the attribute mapping configuration and the item subtype setup looks correct in the admin console. The PX error handling doesn’t provide much detail beyond the stack trace. This is blocking our automated item creation workflow that processes hundreds of configuration items daily. Has anyone encountered similar attribute mapping issues with PX scripts after version upgrades?

One more thing to check - the item subtype configuration might have validation rules that weren’t there before. In 9.3.4, Oracle added stricter validation for item creation. If your subtype has required attributes that must be set before others, you’ll get NPE. The order of attribute setting matters now. Try setting all required attributes first, then the optional ones.

Thanks for the suggestions. I verified the attribute API name and it matches what we’re using. The attribute is definitely mapped to the subtype - I can see it in the admin console and can set it manually through the UI. The strange part is this works in test but fails in production, both running 9.3.4.

I’ve seen this before. The NullPointerException usually means the attributeId isn’t resolving correctly. Did you check if the attribute API name changed during the upgrade? Sometimes custom attributes get renamed in the schema.

Adding to Sara’s point - also verify that the item subtype actually has the attribute you’re trying to set. In 9.3.4, Oracle tightened the validation rules for attribute assignments. You need to ensure the attribute is explicitly mapped to that subtype in the class configuration. Check the subtype’s attribute list in the Java Client admin console under Data Settings > Classes. If the attribute isn’t there, you’ll get a null reference when trying to access it through the API.

Check your PX script’s error handling for the attribute value itself. If attributeValue is null or the wrong data type, setValue() can throw NPE in 9.3.4. Also, verify that the session object has proper privileges. I’ve seen cases where the PX execution context doesn’t have the required permissions to set certain attributes, especially custom ones with restricted access. Try wrapping your code with explicit null checks and type validation before the setValue() call.