Show:

fields Methods

Methods

addIcon
(
  • field
  • img
  • elemId
)

Adds an icon to a field.

Parameters:

  • field String

    Specifies the name of the field for which an icon is to be added.

  • img String

    Specifies the file that contains the icon to add.

  • elemId Boolean

    When this parameter is present, an ID is created for the icon.
    When this parameter is omitted, no ID is created.

Returns:

Object

Examples:

    // Adds the Default.gif icon to the user_invited field.
    crm("user_invited").addIcon("../Themes/Img/Default.gif");
    // Adds the Default.gif icon to the user_invited field and creates an ID for the icon.
    crm("user_invited").addIcon("../Themes/Img/Default.gif", "elemId");
appendIconToCaption
(
  • obj
)
deprecated

Deprecated: This method is no longer supported. Use the AddIcon method provided for the Fields class.

Adds an icon to a field caption.

Parameters:

  • obj Object

    Specifies the icon to add in the form of a JSON object.

Returns:

Nothing

Examples:

    // Adds the icon from the min.gif file to the caption of the case_problemnote field.
    crm.fields("case_problemnote").appendIconToCaption({ id : this.name + "_popUpImg",
    src : "../Themes/Img/Color/Buttons/min.gif", height:"15",width:"15", click:function(){alert(1)}})
background
(
  • color
)

Sets the background color of a field caption.

Parameters:

  • color String | Boolean

    Specifies the background color name.
    When this parameter is empty, the background color is yellow by default.
    When this parameter is set to false, no background color is used.

Returns:

Object

Examples:

    // Sets the background color of the case_problemnote field caption to yellow.
    crm.fields("case_problemnote").caption().background(); 
    // Sets the background color of the case_problemnote field caption to red.
    crm.fields("case_problemnote").caption().background("red"); 
    // Removes background color from the case_problemnote field caption.
    crm.fields("case_problemnote").caption().background(false);
bold
(
  • remove
)

Displays a field value in bold font.

Parameters:

  • remove Boolean

    When this parameter is empty, the field value is displayed in bold font.
    When this parameter is set to false, the field value is displayed in normal font.

Returns:

Object

Examples:

    // Sets the font weight of the case_problemnote field value to bold.
    crm.fields("case_problemnote").caption().bold();
    // Sets the font weight of the case_problemnote field value to normal.
    crm.fields("case_problemnote").caption().bold(false);
collapse
()

Collapses a hidden field and moves a visible field in its place to save up screen space.

Returns:

Object

Examples:

    // Collapses the case_problemtype field.
    crm.fields("case_problemtype").collapse()
color
(
  • obj
)

Sets a custom color for a field value.

Parameters:

  • obj String | Boolean

    Specifies the custom color to apply to the field value.
    When this parameter is set to false, the default color is used (black).

Returns:

Object

Examples:

    // Sets the color of the case_problemnote field value to red.
    crm.fields("case_problemnote").caption().color("red");
    // Sets the color of the case_problemnote field value to black.
    crm.fields("case_problemnote").caption().color(false);
fadeIn
()

Slowly shows a field and its value on the user interface.

Returns:

Object

Examples:

    // Slowly shows the case_problemnote field and its value on the user interface.
    crm.fields("case_problemnote").fadeIn();
fadeOut
(
  • obj
)

Slowly hides a field and its caption on the user interface.

Parameters:

  • obj Boolean

    When this parameter is empty, the field and its caption slowly disappear.
    When this parameter is set to false, the field and its caption are shown.

Returns:

Object

Examples:

    // Shows the case_problemnote field and its caption on the user interface.
    crm.fields("case_problemnote").fadeOut(false);
    // Causes the case_problemnote field and its caption to disappear slowly from the user interface.
    crm.fields("case_problemnote").fadeOut();
fields
(
  • fieldName
)

Gets values of the specified fields.

Parameters:

  • fieldName String | | Null

    Specifies the names of the fields.

Returns:

Object

Examples:

    // Returns the value of the comp_name field.
    crm.fields('comp_name') 
    // Returns values of all fields except comp_name.
    crm.fields('!comp_name')
    // Returns values of all fields except comp_name and comp_description.
    crm.fields('!comp_name !comp_description')
    // Returns values of all fields.
    crm.fields()
fontSize
(
  • obj
)

Sets the font size (in pixels) of a field value.

Parameters:

  • obj String | Boolean

    Specifies the font size to apply.
    When this parameter is set to false, the default font size is used.

Returns:

Object

Examples:

    // Sets the font size for the case_problemnote field value to 20 pixels.
    crm.fields("case_problemnote").caption().fontSize(20);
hide
(
  • obj
)

Hides a field and its value on the user interface.

Parameters:

  • obj Boolean

    When this parameter is empty, the field and its value are hidden.
    When this parameter is set to false, the field and its value are shown.

Returns:

Object

Examples:

    // Hides the case_problemnote field and its value.
    crm.fields("case_problemnote").caption().hide();
    // Displays the case_problemnote field and its value.
    crm.fields("case_problemnote").caption().hide(false); 
highlight
(
  • obj
)

Highlights a field value in the specified color.

Parameters:

  • obj String | Boolean

    Specifies the name of the color in which to highlight the field.
    When this parameter is empty, the field value is highlighted in yellow by default.
    When this parameter is set to false, it removes the highlight from the field value.

Returns:

Object

Examples:

    // Highlights the value of the oppo_description field in yellow.
    crm.fields("oppo_description").highlight();
    // Highlights the value of the oppo_description field in red.
    crm.fields("oppo_description").highlight("red");
    // Removes the highlight from the oppo_description field value.
    crm.fields("oppo_description").highlight(false); 
hint
(
  • obj
)

Sets a tooltip on a field value.

Parameters:

  • obj String

    Specifies the tooltip text.

Returns:

Object

Examples:

    // Sets the tooltip "This is a sample tooltip." on the value of the case_problemnote field.
    crm.fields("case_problemnote").hint("This is a sample tooltip.");
inputSize
(
  • obj
)
deprecated

Deprecated: This method is no longer supported. To set the input size of a field, use the Administration area in the user interface.

Sets the input size of a given field. This method only works for single-line text fields in edit mode.

Parameters:

  • obj Number

    Specifies the field input size (in characters).

Returns:

Object

Examples:

    // Sets the input size of the case_description field to 5 characters.
    crm.fields("case_description").inputSize("5");
italic
(
  • obj
)

Italicizes the font of a field value.

Parameters:

  • obj Boolean

    When this parameter is empty, the field value is displayed in italic font.
    When this parameter is set to false, the field value is displayed in normal font.

Returns:

Object

Examples:

    // Italicizes the value of the case_problemnote field.
    crm.fields("case_problemnote").caption().hide();
    // Displays the value of the case_problemnote field in normal font.
    crm.fields("case_problemnote").caption().italic(false);
maxLength
(
  • obj
)

Sets the maximum length of a field value.

Parameters:

  • obj Number

    Specifies the maximum field value length in characters.
    The value in this parameter cannot exceed the default maximum length defined for the field value.

Returns:

Object

Examples:

    // Sets the maximum length of the case_description field value to 50 characters.
    crm.fields("case_description").maxLength("50");
minimise
(
  • obj
)

Adds a link to the bottom of a text field allowing a user to expand or collapse the field value.
This method works in view mode only.

Parameters:

  • obj Number

    Specifies the height (in pixels) to which the text field value is collapsed.

Returns:

Object

Examples:

    // Adds a collapse/expand link to the bottom of the case_problemnote field. 
    // When that field value is collapsed, its height is 15 pixels.
    crm.fields("case_problemnote").minimise(15);
overline
(
  • obj
)

Adds a line above a field value.

Parameters:

  • obj Boolean

    When this parameter is empty, there is a line above the field value.
    When this parameter is set to false, there is no line above the field value.

Returns:

Object

Examples:

    // Adds a line above the value of the case_problemnote field.
    crm.fields("case_problemnote").caption().overline();
show
(
  • remove
)

Shows a field value that has been hidden.

Parameters:

  • remove Boolean

    When this parameter is empty, the field value is shown.
    When this parameter is set to false, the field value is hidden.

Returns:

Object

Examples:

    // Shows the value of the case_problemnote field on the user interface.
    crm.fields("case_problemnote").show();
strike
(
  • obj
)

Adds a line through the middle of a field value.

Parameters:

  • obj Boolean

    When this parameter is empty, there is a line through the middle of the field value.
    When this parameter is set to false, there is no line through the middle of the field value.

Returns:

Object

Examples:

    // Adds a line through the middle of the case_problemnote field value.
    crm.fields("case_problemnote").caption().strike();
title
(
  • obj
)
deprecated

Deprecated: This method is no longer supported. Use the Hint method provided for the Fields class.

Sets the tooltip of a field.

Parameters:

  • obj String

    Specifies the tooltip text to set.

Returns:

Object

Examples:

    // Sets the tooltip of the case_problemnote field to "This is my tooltip text."
    crm.fields("case_problemnote").title("This is my tooltip text.");
underline
(
  • obj
)

Adds a line under a field value.

Parameters:

  • obj Boolean

    When this parameter is empty, there is a line under the field value.
    When this parameter is set to false, there is no line under the field value.

Returns:

Object

Examples:

    // Adds a line under the value of the case_problemnote field.
    crm.fields("case_problemnote").underline();
urlToImage
(
  • options
)

Displays an image for a URL value.

Parameters:

  • options Boolean | Object

    Provides JSON description of the image and its properties.
    When this parameter is set to False, it returns the file DTO normal.

Returns:

Object

Examples:

    // Uses the value of the field as the source of the image.
    crm.fields("prod_url").urlToImage();
    // Creates an image using the specified source.
    crm.fields("comp_name").urlToImage({src:"../Themes/Img/Color1/Buttons/min.gif"});
    // Creates an image using the specified source and click event.
    crm.fields("comp_name").urlToImage({src:"../Themes/Img/Color1/Buttons/min.gif",
    click : function(){alert(1)}});
val
(
  • val
)

Sets the value of a specified field. This method only works in edit mode.

Parameters:

Returns:

String

Examples:

    //Gets the value of the comp_name field
    crm.fields("comp_name").val();
    // Sets the value of the comp_name field value to ACME Inc.
    crm.fields("comp_name").val("ACME Inc.");
    // Sets the value of the oppo_priority field value to High.
    crm.fields("oppo_priority").val("High");
    // Sets the oppo_targetclose field value to one week from now.
    var oneWeekFromNow = new Date();
    oneWeekFromNow.setDate(oneWeekFromNow.getDate() + 7);
    crm.fields("oppo_targetclose").val(oneWeekFromNow);
value
()

Gets or sets the value of a selected field. Setting the value only works in edit mode.

Returns:

String | Number | Date
Returned value depends on the field type.

Examples:

    // Gets the value of the comp_name field.
    crm.fields("comp_name").value();
    // Sets the comp_name field value to ACME Inc.
    crm.fields("comp_name").value("ACME Inc.");
    // Sets the oppo_priority field value to High.
    crm.fields("oppo_priority").value("High");
    // Sets the oppo_targetclose field value to one week from now.
    var oneWeekFromNow = new Date();
    oneWeekFromNow.setDate(oneWeekFromNow.getDate() + 7);
    crm.fields("oppo_targetclose").value(oneWeekFromNow)

© Copyright Sage Technologies. All rights reserved.