In Revenue Cloud (Revenue Lifecycle Management, abbreviated RLM), a SOQL query against AssetStatePeriodAttribute returns 0 rows immediately after a record is created with Database.insertImmediate() in Apex. This commonly happens inside an @isTest method after Test.stopTest(). No DML exception is thrown during the insert, so the record appears to be created successfully.
The behavior is consistent across approaches, including the CreateOrUpdateAssetFromOrder pattern and Test.startTest()/Test.stopTest() patterns.
The following Apex pattern reproduces the issue. It builds an AssetStatePeriodAttribute record with an asset state period ID, an attribute definition ID, and a text value of "TestValue". It then calls Database.insertImmediate() between Test.startTest() and Test.stopTest(), and runs a SOQL query that selects one AssetStatePeriodAttribute record.
AssetStatePeriodAttribute aspa = new AssetStatePeriodAttribute(
AssetStatePeriodId = asp.Id,
AttributeDefinitionId = attrDef.Id,
AttributeValue = 'TestValue'
);
Test.startTest();
Database.insertImmediate(aspa);
Test.stopTest();
// Returns 0 rows:
List<AssetStatePeriodAttribute> result = [SELECT Id FROM AssetStatePeriodAttribute LIMIT 1];
The final query returns an empty list even though the insert completed without error.
AssetStatePeriodAttribute in Revenue Cloud RLM is a virtual entity. Virtual entities use an asynchronous write pipeline. After Database.insertImmediate() completes, a replication delay occurs before the record becomes accessible through SOQL. The length of the delay is not fixed or documented, and it cannot be configured. This is Working as Designed (WAD) platform behavior.
The following steps confirm that an AssetStatePeriodAttribute record was created successfully without depending on SOQL availability. No supported method exists to query the record immediately after creation, because virtual entity writes are asynchronous.
Database.SaveResult result = Database.insertImmediate(aspa);
System.assert(
result.isSuccess(),
'AssetStatePeriodAttribute insert failed: ' + result.getErrors()[0].getMessage()
);
The code stores the insert outcome in a SaveResult object and asserts that the insert succeeded. If the insert fails, the assertion fails and displays the first error message returned by the platform.
005462556

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.