Oracle CRM On Demand JavaScript API Developer's Guide > JavaScript API Reference >

Methods for the Context Object


You can get information about the current page and logged-in user to make decisions in your custom JavaScript code, for example, to determine when a script executes.

The methods shown in Table 9 are helper functions that wrap the attributes for the context object shown in Table 10. As a guideline use the helper methods, which are more convenient than using the attributes directly because they return Boolean values. If you use an attribute directly, then you have to do a comparison, such as the following:

if(oraclecrmod.ctx.pageType == "D")

Whereas using a helper method like the following is simpler and clearer:

if(oraclecrmod.ctx.isDetailPage()

Table 9. Helper Methods for the Context Object
Method Name
Description
Parameters and Notes

isHomePage

Returns whether the current page type is Homepage

None

isListPage

Returns whether the current page is a List page

None

isDetailPage

Returns whether the current page type is Detail page

None

isEditPage

Returns whether the current page type is Edit page

None

isNewPage

Returns whether the current page type is New page

None

isEditOrNewPage

Returns whether the current page type is Edit page or New page

None

isAdminPage

Returns whether the current page type is Admin page

None

isObject(object)

Returns whether the current page's primary object is the record type in the parameter

The String object parameter is the record type, for example: oraclecrmod.ctx.isObject("Account")

All of the helper methods have a Boolean return type. Table 10 shows the attributes for the context object.

Table 10. Attributes for the Context Object
Attribute
Type
Description
Sample Values and Code

servlet

String

The current servlet path.

oraclecrmod.ctx.servlet == "/user/AccountHomePage"

pageType

String

An alphabetic character representing the current page type.

H for Homepage, L for List page, D for Detail page, N for New page, E for Edit page, and A for Admin page.

if (oraclecrmod.ctx.pageType=="D") {...}

object

String

The current record type name.

"Account", "CustomObject4"

layoutId

String

The row ID for the current layout in use, which you can find in the URL of the Page Layout Wizard editing page. For a standard layout, the URL has no row ID, and this attribute has the value of the standard layout name.

"1QA2-P4F9O", "Lead"

layoutName

String

The display name for the current layout.

"myAcctLayout"

roleId

String

The row ID for the current user's role, which you can find in the URL of the Role Management Wizard editing page.

"1-G4WZO"

roleName

String

The name of the current user role, unlocalized

"Administrator"

lang

String

The current user's language as a three-character code

NOTE:  See Oracle Migration Tool On Demand Guide for a list of the language codes supported for Oracle CRM On Demand.

"enu", "deu"

userId

String

The user ID of the currently logged-in user.

"1QA3-HTE12"

userCountryLIC

String

The country (LIC value) of the currently logged-in user.

"Korea"

userEmail

String

The email of the currently logged-in user.

"mini.me@acme.com"

userAlias

String

The user alias of the currently logged-in user.

"minime"

userFullName

String

The full name of the currently logged-in user.

"Mini Me"

Oracle CRM On Demand JavaScript API Developer's Guide, Release 37 Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Legal Notices.