Monday 18 November 2019

Javascript Reference for Dynamics 365 9.0

Javascript Reference for Dynamics 365 9.0



1.       Get the Attribute type
formContext.getAttribute(“Field name”).getAttributeType()
It will Returns a string value that represents the attribute type. Following are the return types
·         Boolean
·         datetime
·         decimal
·         double
·         integer
·         lookup
·         memo
·         money
·         multioptionset
·         optionset
·         string
2.       Get the format type
formContext.getAttribute(“fieldname”).getFormat()
It will Returns a string value that represents the format type. Following are the format types
·         date
·         datetime
·         duration
·         email
·         language
·         none
·         phone
·         text
·         textarea
·         tickersymbol
·         timezone
·         url

3.       Get the Initial Value
formContext.getAttribute(“fieldname”).getInitialValue()
Returns a value that represents the value set for a Boolean, OptionSet or MultiSelectOptionSet attribute when the form is opened.
4.       getIsDirty
formContext.getAttribute(“Fieldname”).getIsDirty()
Returns a Boolean value indicating if there are unsaved changes to the attribute value.
5.       getIsPartylist
formContext.getAttribute(“field name”).getIsPartyList()
Returns a Boolean value indicating whether the lookup represents a partylist lookup. Partylist lookups allow for multiple records to be set, such as the To: field for an email entity record.
6.       getMax
formContext.getAttribute(“Field Name”).getMax()
Returns a number indicating the maximum allowed value for an attribute.
7.       getName
formContext.getAttribute("fieldname").getName()
Returns a string representing the logical name of the attribute.
8.       getOption
formContext.getAttribute(“Fieldname”).getOption(value)
Returns an option object with the value matching the argument (label or enumeration value) passed to the method.
9.       getOptions
formContext.getAttribute(arg).getOptions()
Returns an array of option objects representing valid options for an attribute.
10.   getParent
formContext.getAttribute("fieldname").getParent()
Returns the formContext.data.entity object that is the parent to all attributes
11.   getPrecision
formContext.getAttribute(“fieldname”).getPrecision()
Returns the number of digits allowed to the right of the decimal point.
12.   getRequireLevel
formContext.getAttribute(“fieldName”).getRequiredLevel()
Returns a string value indicating whether a value for the attribute is required or recommended
13.   getSelectedOption
formContext.getAttribute(arg).getSelectedOption()
Returns the option object or an array of option objects selected in an optionset or multiselectoptionset attribute respectively.
14.   getSubmitMode
formContext.getAttribute(arg).getSubmitMode()
Returns a string indicating when data from the attribute will be submitted when the record is saved.
15.   getText
formContext.getAttribute(arg).getText()
Returns a string value of the text for the currently selected option for an optionset or multiselectoptionset attribute.
16.   getUserPrivilege
formContext.getAttribute(arg).getUserPrivilege()
Returns an object with three Boolean properties corresponding to privileges indicating if the user can create, read or update data values for an attribute. This function is intended for use when Field Level Security modifies a user’s privileges for a particular attribute
17.   getValue
formContext.getAttribute(arg).getValue()
Retrieves the data value for an attribute.
18.   isValid
formContext.getAttribute(arg).isValid();
Returns a boolean value to indicate whether the value of an attribute is valid.
19.   removeOnChnage
formContext.getAttribute(arg).removeOnChange(myFunction)
Removes a function from the OnChange event hander for an attribute..
20.   setPrecision
formContext.getAttribute(arg).setPrecision(value);
Sets the number of digits allowed to the right of the decimal point.
21.   setRequiredLevel
formContext.getAttribute(arg).setRequiredLevel(requirementLevel)
Sets whether data is required or recommended for the attribute before the record can be saved.
Note:
Reducing the required level of an attribute can cause an error when the page is saved. If the attribute is required by the server, an error will occur if there is no value for the attribute.
22.   setSubmitMode
formContext.getAttribute(arg).setSubmitMode(mode)
Sets whether data from the attribute will be submitted when the record is saved.
23.   setValue
formContext.getAttribute(arg).setValue(value)
Sets the data value for an attribute.
24.   Set LookupValue
function SetLookupFieldVaue(fieldName, id, name, entityType) {
    if (fieldName != null) {
        var lookupVal = new Array();
        lookupVal[0] = new Object();
        lookupVal[0].id = id;
        lookupVal[0].name = name;
        lookupVal[0].entityType = entityType;
                                formContext.getAttribute(fieldName).setValue(lookupVal);
    }
}
25.   Get Composite fields
formContext.getControl("address1_composite_compositionLinkControl_address1_line1")
26.   Get Control
formContext.getControl(arg);
Gets a control on the form.
27.   Get Control type
getControl(arg).getControlType();
Returns a value that categorizes controls.
ex:iframe,lookup,composite,multiselectoptionset,subgrid,notes,optionset,quickform,webresource,timewall,timecontrol
28.   Show/Hide controls or fields
formContext.getAttribute(arg).setVisible(true)//show
formContext.getAttribute(arg).setVisible(false)//hide

29.   Progress dialog box
OOB Feature added in D365 9.0
Xrm.Utility.showProgressIndicator(message)//to show the progress indicator
Xrm.Utility.closeProgressIndicator()//to stop the progress indicator

No comments:

Post a Comment

SSDT for Visual Studio (VS) 2015

In this course, we will learn to implement and build a SSRS Report in Dynamics CRM. The Microsoft’s Dynamics 365 CRM and Model Driven PowerA...