Human-readable Change History - Object reference not set to an instance of an object


I am trying to use the human readable component. I tried to call it inside an action where we update the country. This action gets as input parameter a country record - CountryRec, it tries to find the country by id making an aggregate GetCountrybyid, makes some validations then calls createorupdate for that entity. After this call I would call the recordifferences(also tried directly with the DiffEntities). In the original object parameter I would put ToObject(GetCountryById.List.Current) and in the changed object parameter I would put the ToObject(CountryRec).

In this scenario I get Object reference not set to an instance of an object.

If after the createorupdate country action I get again that country by id using another aggregate and I put this in the changed object then it works. I do not know why the countryrec is seen as null inside the extension and get that error in the first example....

If someone could help me with this I would be really really happy since I am struggling a bit with this component :)


Hi Ileana,

Could you please check whether the type of CountryRec is Record of X or just X (X being the Entity)? If the latter, could you please change it to the former and try again?

If that works, the reasons is that starting with P9, you can have a variable whose type is just an Entity or Structure, instead of a Record of that structure (ditto of List of Entity/Structure vs. List of Entity/Structure Record). However, the former are more difficult to handle in an extensions (and there's no official documentation yet!) than Records and Record Lists, so many extensions (especially those predating version 9) can't handle them.


Hi Kilian,

You were right that was it. Unfortunately I am trying to apply an audit on an application where all of my parameters are defined like that directly type Entity so it seems I will have to do lots of changes if I want to implement db audit with this component.

Thank you very much for your answer!