Look up dimension value by dimension attribute name in AX 2012

public static void lookupDimensionValueByAttribute(FormStringControl _formControl, Name _dimensionAttributeName)
{
    Args                    args;
    FormRun                 lookupFormRun;
    DimensionAttribute      dimAttr;
    Object                  object;

    if (_formControl != null)
    {
        // Construct arguments for the custom lookup
        args = new Args();
        args.name(formStr(DimensionDefaultingLookup));
        args.lookupValue(_formControl.text());
        args.caller(_formControl);

        // Find the dimension attribute associated with the string control which called this method
        dimAttr = DimensionAttribute::findByLocalizedName(_dimensionAttributeName);
        args.lookupField(dimAttr.ValueAttribute);
        args.record(dimAttr);

        // Run the custom lookup and init the lookup form
        lookupFormRun = classfactory.formRunClass(args);
        lookupFormRun.init();

        // Specify this is the callback on the lookup form by casting the
        // form to an object and late binding the setResultCallback method
        if (SysFormRun::hasMethod(lookupFormRun, identifierStr(setResultCallback)))
        {
            object = lookupFormRun;
            object.setResultCallback();
        }

        _formControl.performFormLookup(lookupFormRun);
    }
}