2
Views
7
Comments
XMLRecords - parameter must be valid IRecord
Discussion
I've tried to use RecordToXml with a record as input - converted to an object with ToObject().
However it gives the above error message. What does it mean? I wasn't able to find any info anywhere.
2024-01-22 15-21-29
Pedro Cardoso
Hello Claus.

We're missing the error message. Can you add it?
UserImage.jpg
ClausS
It's in the heading: "Parameter must be valid IRecord"
However, I got it to work with RecordListToXml instead, but I still don't know the reason for the above error.
2024-01-22 15-21-29
Pedro Cardoso
Sometimes you need to pass the "record.record" instead of just "record" to the extension. Can you try that?
UserImage.jpg
ClausS
Yeah, will do - however, I actually need much more help with my other question related to XML Records?
Can you check that out and that will be much helpful, thanks!
2024-01-22 15-21-29
Pedro Cardoso
It would be simplier if you could provide a sample espace that I could check. Are you able to do that?
UserImage.jpg
ClausS
I've attached a sample espace. If you go to the "Edit Company" page there are two buttons that run respectively RecordToXml() and RecordListToXml(). In fact they now produce the same output and both work without giving the above error message.

However, the employees that are linked to companies are not exported as part of the XML. This is what I would like to achieve. How can I inform XML Records that the employee records that are associated with a specific company should be exported as xml attributes within the overall xml record for company?

Can it be done by turning the entities into structures instead? There you can actually specify a "record list" as an attribute. This is not possible for entities, sadly. But having to convert all entities into structures seems like a lot of work to achieve something this simple.
Company_Employees.oml
2020-09-15 13-07-23
Kilian Hekhuis
 
MVP
I encounter the same problem. When I have a record that is composed of multiple entity records, I cannot pass one of the sub-records as input: I get the "parameter must be valid IRecord" error. I put some debug logging in the extension, and found that while the full record has a type that's something along the lines of ssMyEspace.RCDB_RECORD1DB_RECORD2DB_RECORD3Record, if I specify just DB_RECORD1, it's type ssMyEspace.ENDB_RECORD1EntityRecord. So it seems an entity record by itself is not an IRecord. Anyone knowledgeable with the platform's internals who can explain this?
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.