Open bansmani opened 3 years ago
Could we get more info on what the value of the "oid" variable is above?
The following code works for me to create an epic underneath another epic. "Epic:7632" is the oid token that refers to a specific Epic in my instance. '7632' is not easily viewable in the interface and is different from the Number (sometimes displayed by the name ID in the interface). A string visible in the interface such as 'E-01128' refers to the Number attribute of the Epic Asset Type and not the number to be used to compose the OID (object identifier) token.
Oid epicContext = services.getOid("Epic:7632");
IAssetType epicType = services.getMeta().getAssetType("Epic");
Asset newEpic = services.createNew(epicType, epicContext);
newEpic.setAttributeValue(epicType.getAttributeDefinition("Name"), "this is a test epic");
newEpic.setAttributeValue(epicType.getAttributeDefinition("Description"), "auto generated section");
services.save(newEpic);
Creating "Epic:01128" based on the number in "E-01128" would be an invalid OID token. To get the OID from an Asset Number like "E-01128", you would have to query for the asset OID and then proceed with the code above.
IAssetType epicType = services.getMeta().getAssetType("Epic");
Query query = new Query(epicType);
IAttributeDefinition numberAttribute = epicType.getAttributeDefinition("Number");
FilterTerm numberFilter = new FilterTerm(numberAttribute);
numberFilter.equal("E-01128");
query.setFilter(numberFilter);
Asset epicContext = services.retrieve(query).getAssets()[0];
Asset newEpic = services.createNew(epicType, epicContext.getOid());
newEpic.setAttributeValue(epicType.getAttributeDefinition("Name"), "this is a test epic");
newEpic.setAttributeValue(epicType.getAttributeDefinition("Description"), "auto generated section");
services.save(newEpic);
I am facing some challenges creating assets (Epic) in version one in our sandbox environment using the below example code.
https://community.versionone.com/Digital.ai_Agility_Integrations/Developer_Library/Get_an_SDK/Java_SDK/Creating_Assets
We are getting follow exception (excluding the complete stack trace)
My code