Tuesday, September 20, 2016
Monday, September 19, 2016
Filter lookup based on another lookup - Microsoft Dynamics CRM
Based on one lookup:
Right click on field and go to change properties.
Select the checkbox and select the drop down in "Related Records Filtering" Section
Based on two lookup:
Call the function onchange of second lookup and onload of form.
It will add filter for third lookup.
Lookup1: ccs_category
Lookup2:ccs_casetype
Lookup3:ccs_subtype
Javascript Function:
function filterSubtype() {
// add the event handler for PreSearch Event
Xrm.Page.getControl("subtype").addPreSearch(subtype_addFilter);
}
function subtype_addFilter() {
//find contact contains this @example.com
var categoryId = Xrm.Page.getAttribute("category").getValue() != null ? Xrm.Page.getAttribute("category").getValue()[0].id : null;
var caseTypeId = Xrm.Page.getAttribute("casetype").getValue() != null ? Xrm.Page.getAttribute("casetype").getValue()[0].id : null;
//create a filter xml
var filter = "<filter type='and'><condition attribute='category' operator='eq' value='" + categoryId + "' /><condition attribute='casetype' operator='eq' value='" + caseTypeId + "' /></filter>";
//add filter
Xrm.Page.getControl("subtype").addCustomFilter(filter);
}
Right click on field and go to change properties.
Select the checkbox and select the drop down in "Related Records Filtering" Section
Based on two lookup:
Call the function onchange of second lookup and onload of form.
It will add filter for third lookup.
Lookup1: ccs_category
Lookup2:ccs_casetype
Lookup3:ccs_subtype
Javascript Function:
function filterSubtype() {
// add the event handler for PreSearch Event
Xrm.Page.getControl("subtype").addPreSearch(subtype_addFilter);
}
function subtype_addFilter() {
//find contact contains this @example.com
var categoryId = Xrm.Page.getAttribute("category").getValue() != null ? Xrm.Page.getAttribute("category").getValue()[0].id : null;
var caseTypeId = Xrm.Page.getAttribute("casetype").getValue() != null ? Xrm.Page.getAttribute("casetype").getValue()[0].id : null;
//create a filter xml
var filter = "<filter type='and'><condition attribute='category' operator='eq' value='" + categoryId + "' /><condition attribute='casetype' operator='eq' value='" + caseTypeId + "' /></filter>";
//add filter
Xrm.Page.getControl("subtype").addCustomFilter(filter);
}
Tuesday, September 6, 2016
Microsoft Dynamics CRM 2013 Javascript
Xrm.Utility
|
alertDialog Displays a dialog box
with a message.
|
confirmDialog
Displays a confirmation dialog box
that contains
an optional message as well as
OK and Cancel buttons.
|
isActivityType
Determine if
an entity is an
activity entity.
|
openEntityForm
Opens
an entity form.
|
openWebResource Opens
an HTML web resource.
|
Xrm.Page.data
|
getIsValid Do a
validation check for the data in the form.
|
refresh Asynchronously refresh all the
data of the form without reloading
the page.
|
save Saves
the record asynchronously with the option
to set callback
functions to be executed after the save operation
is completed.
|
Xrm.Page.ui
|
|
clearFormNotification
Remove form
level notifications.
|
|
close Method to close the form.
|
|
controls A collection
of all the controls
on the page.
|
|
formSelector.getCurrentItem Method to return a reference to the form currently being shown.
|
|
formSelector.items
A collection
of all the form
items accessible to the current user.
|
|
getViewPortHeight
Method to get the
height of the viewport
in pixels.
|
|
getViewPortWidth Method to get the width of the viewport
in pixels.
|
|
getCurrentControl
Method to get the
control object that currently has focus
on the form.
|
|
getFormType
Method to get the
form context for the
record.
|
|
navigation.items A collection
of all the navigation items on the
page.
|
|
setFormNotification
Display
form level
notifications.
|
|
refreshRibbon
|
Method to cause
the ribbon to re-evaluate data
that
controls what is displayed in it.
|
Xrm.Page.data.entity
|
addOnSave Adds a
function to be called
when the record
is saved.
|
attributes The
collection
of attributes for the entity.
|
getDataXml Returns a string
representing the xml that will be sent
to the server when the record is saved.
|
getEntityName Returns a string
representing the logical
name of the entity
for the record.
|
getId Returns a string
representing the GUID id value for the
record.
|
getIsDirty Returns a Boolean
value that indicates if
any fields in the form have
been modified.
|
getPrimaryAttributeValue Gets a string for the value of the
primary
attribute of the entity.
|
removeOnSave Removes
a function to be called when the
record is saved.
|
save Saves
the record with the options
to close the form or open
a new form after
the save is completed.
|
Xrm.Page.getAttribute("...")
|
getAttributeType Get the type
of attribute.
|
getFormat Get the
attribute format.
|
getIsDirty
Determine whether the
value of an attribute has
changed since it was
last saved.
|
getIsPartyList
Determine whether a lookup attribute represents a
partylist lookup.
|
getMaxLength Get the
maximum length of string
which an
attribute that stores
string data can have.
|
getName
Get the
name of the
attribute.
|
getParent
parent to all attributes.
|
getRequiredLevel Returns a
string value indicating whether a
value for the attribute
is required or recommended.
|
getSubmitMode
Sets whether data from the
attribute will
be submitted when
the record is saved.
always / never /
dirty
|
getUserPrivilege Determine what
privileges a
user has for fields
using Field
Level
Security.
|
getValue
Retrieves the
data value for
an attribute.
|
setRequiredLevel Sets whether data is
required or recommended
for the attribute
before the record
can be saved.
none
/ required / recommended
|
setSubmitMode
Returns a
string indicating when data from the
attribute will be submitted
when the record is saved.
|
setValue
Sets the data value for an attribute.
|
Number
|
getMax Returns a
number indicating the maximum allowed value
for an attribute.
|
getMin Returns a
number indicating the minimum allowed value for
an attribute.
|
getPrecision
Returns the number of digits allowed to the
right of
the decimal point.
|
OnChange Event
|
addOnChange
Sets a function
to be called when the attribute value is changed.
|
fireOnChange Causes the OnChange
event to occur on the attribute so that any script associated to that event can execute.
|
removeOnChange
Removes a function
from the OnChange
event hander for an
attribute.
|
OptionSet
|
getInitialValue
Returns a
value
that represents the value
set for an optionset
or
boolean
attribute when the form opened.
|
getOption Returns
an option object with the
value matching the
argument passed
to the method.
|
getOptions Returns
an option object with the
value matching the argument passed
to the method.
|
getSelectedOption Returns the option object that is selected
in an optionset attribute.
|
getText Returns a
string value of the text for the currently selected option
for an optionset attribute.
|
Xrm.Page.context
|
|
client.getClient
Returns a
value
to indicate which
client the
script is executing in.
|
|
client.getClientState Returns a
value
to indicate the state of the
client.
|
|
getClientUrl
Returns the base URL that was used to access
the application.
|
|
getCurrentTheme
Returns a
string representing the current Microsoft Office
Outlook theme chosen by the user.
|
|
getOrgLcid
Returns the LCID
value that represents the base language for
the organization.
|
|
getOrgUniqueName
Returns the unique text value
of the organization’s
name.
|
|
getQueryStringParameters Returns a
dictionary
object of key value pairs
that represent
the query string
arguments that were passed to the page.
|
|
getUserId Returns the GUID
of the SystemUser.Id
value for the
current user.
|
|
getUserLcid Returns the LCID
value that represents the provisioned language that the
user selected as
their
preferred language.
|
|
getUserName Returns the name of the current user.
|
|
getUserRoles Returns
an array of strings that represent the
GUID values of
each of the security roles that the user is associated with.
|
|
isOutlookClient (Deprecated) Returns a
Boolean
value indicating if the user is using Microsoft Dynamics
CRM for Microsoft Office
Outlook.
|
|
isOutlookOnline
(Deprecated) Returns a
Boolean
value that indicates whether the user is connected to the
Microsoft Dynamics CRM
server.
|
|
prependOrgName
Prepends the organization
name to the specified path.
|
Xrm.Page.getControl("...")
|
clearNotification Remove a message
already displayed for a
control.
|
getAttribute Get the
attribute that the control is bound to.
|
getControlType
Get information about the type of control.
|
getDisabled Returns whether the control is disabled.
|
getLabel Returns the label for the
control.
|
getName
Get the
name of the
control.
|
getParent
Get the
section object that the
control is in.
|
getVisible
Returns a
value
that indicates whether the control is currently
visible.
|
setDisabled Sets whether the control is disabled.
|
setFocus
Sets the
focus on the control.
|
setLabel Sets the
label for the control.
|
setNotification
Display
a message near the
control to indicate that data
is not valid.
|
setVisible
Sets a value
that indicates whether the control is
visible.
|
DateTime
|
setIsAllDay
Specify whether a
date control should set a value including the entire day.
|
setShowTime
Specify whether a
date control should show
the time portion
of the date.
|
Lookup
|
addCustomFilter Use
fetchXml to
add additional filters to the
results displayed
in the lookup. Each filter will be combined
with any previously added filters as an ‘AND’ condition.
|
addCustomView
Adds a new
view for the lookup dialog box.
|
addPreSearch Use
this method to apply changes to lookups based on
values current just as the
user is about to
view results
for the lookup.
|
getDefaultView Returns the Id
value of the default lookup
dialog view.
|
removePreSearch Use
this method to remove
event handler
functions that have previously been
set for the
PreSearch event.
|
setDefaultView Sets the
default view
for the lookup control dialog.
|
OptionSet
|
addOption
Adds an
option to an option set control.
|
clearOptions
Clears all options from an Option Set control.
|
removeOption Removes an
option from an Option Set control.
|
Web Resource
or IFrame
|
getData
Returns the value of the data query string parameter passed
to a Silverlight web resource.
|
getInitialUrl
Returns the
default URL that an I-frame control is configured to display. This method is not
available for web resources.
|
getObject
Returns the object in
the form that represents an I- frame or web resource.
|
getSrc
Returns the current URL being displayed in an IFrame
or web resource.
|
setData Sets the
value of the data
query string parameter
passed to a Silverlight web resource.
|
setSrc Sets the
URL to be
displayed in an IFrame or web
resource.
|
Other Controls
|
refresh Refreshes the
data displayed in a Sub-Grid.
|
setPrecision Override the precision set for a
number attribute.
|
Collections Methods
|
forEach
Apply an action in a
delegate function
to each object in the collection.
|
get Get one
or more object from the
collection depending on the arguments passed.
|
getLength Get the
number of items in the
collection.
|
execObj.getEventArgs().getSaveMode()
|
Save 1
|
Save and Close 2
|
Deactivate 5
|
Reactivate
6
|
Send
(Email) 7
|
Disqualify (Lead) 15
|
Qualify
(Lead) 16
|
Assign (user
or team owned entities)
47
|
Save as Completed (Activities) 58
|
Save and New
59
|
AutoSave 70
|
Xrm.Page.ui.getFormType()
|
Undefined 0
|
Create
1
|
Update 2
|
Read Only 3
|
Disabled 4
|
Quick
Create 5
|
Bulk Edit
6
|
Read Optimized
11
|
Subscribe to:
Posts (Atom)