Showing posts with label Retrieving Entity Object Type code. Show all posts
Showing posts with label Retrieving Entity Object Type code. Show all posts

Wednesday, July 6, 2011

Retrieving Entity Object Type code

// Retrieving Entity Object Type code based on entity schema name

function getObjectTypeCode(entityName) {
 
 try {

        var lookupService = new RemoteCommand("LookupService", "RetrieveTypeCode");
        lookupService.SetParameter("entityName", entityName);
        var result = lookupService.Execute();

        if (result.Success && typeof result.ReturnValue == "number") {
            return result.ReturnValue;
        } else {
            return null;
        }
    }
    catch (ex) {
        throw ex;
    }
}