AX2012: Reading a string from an AOT resource

Sometimes the most basic of concepts become a challenge unless you've seen an example or have any idea that they exist at all. Within Dynamics AX, the use of resources to persist images, blobs or strings is one of those concepts. This is a quick example of how to obtain modeled data that has been persisted as an AOT resource within AX2012.

static str getResourceString(SysElementName _resName)
{
    resourceNode resourceNode = SysResource::getResourceNode(_resName);
    container stringContainier;

    if (!resourceNode)
    {
        return '';
    }

    resourceNode.AOTload();

    stringContainier= SysResource::getResourceNodeData(resourceNode);
    return conPeek(stringContainier, 1);
}

The string can contain default data, XML, HTML or whatever else your application needs.