Tuesday, March 15, 2016

Get Object Type Code Based on Entity Name in Javascript

Hi All,

Please find the Javascript to get Account Type Code.

function onload() {
    var getAccountCode = getobjecttypecode("account");
    alert(getAccountCode);
}

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;
    }

}

No comments:

Post a Comment

Day 11 - Customizing Option Sets Dropdown Fields with JavaScript

  In this Blog, we will see how to Customizing Option Sets Dropdown Fields with JavaScript label1 = formContext.getAttribute( "bosch_op...