.Net (17) (9) 1с8 (4) 1с8.2 УП (3) документирование (1) интеграция (10) карта (1) собеседование (1) ado (1) ajax (11) ASP (1) asp.net (10) authentication (1) c# (14) coding (2) Crm Ribbon (2) csv (1) datareader (1) delegate (5) dhtml (5) exam (1) excel (10) ext (1) extjs (8) google maps (1) iis (3) javascript (33) JSON (5) linq (1) LN (5) log (1) lotus notes (5) mail (1) MS CRM (63) MS CRM 2015 (3) MS CRM 5 (48) MS CRM 6 (28) ms office (2) msi (1) MVC (1) namespace (1) oData (3) outlook (1) parent-child (2) plugin (1) program (4) Project Management (1) remote debugger (1) REST (1) SharePoint (1) SharePoint 2010 (2) Silverlight (2) soft (1) sql (13) sql reporting service (8) sql2005 (3) ssrs (2) Thread (4) tree (1) vb (6) vba (1) VSTO (1) WCF (4) wmi (1) wsc (2) xml (1) Xrm.Page (1) xslt (1)

пятница, 18 декабря 2015 г.

MS CRM 2015: Client script

Xrm.Page.contextfunction _getContext() { var errorMessage = "Context is not available."; if (typeof GetGlobalContext != "undefined") { return GetGlobalContext(); } else { if (typeof Xrm != "undefined") { return Xrm.Page.context; } else { throw new Error(errorMessage); } } } <head></title>Web Resource</title> <script src="../ClientGlobalContext.js.aspx" type="text/javascript" ></script> <script src="Scripts/ContosoScript.js" type="text/javascript"></script> <link href="Styles/ContosoStyles.css" rel="stylesheet" type="text/css" /> </head>
Xrm.Page.contextclient Provides access to the getClient, getClientState and getFormFactor methods you can use to determine which client is being used, whether the client is connected to the server, and what kind of device is being used. getClientUrl getCurrentTheme getIsAutoSaveEnabled getOrgLcid getOrgUniqueName getQueryStringParameters Returns a dictionary object of key value pairs that represent the query string arguments that were passed to the page. getTimeZoneOffsetMinutes Returns the difference between the local time and Coordinated Universal Time (UTC). This method was introduced with Microsoft Dynamics CRM Online 2015 Update 1. getUserId getUserLcid getUserName getUserRoles Returns an array of strings that represent the GUID values of each of the security roles that the user is associated with or any teams that the user is associated with. prependOrgName Prepends the organization name to the specified path.
context (function param)getContext getDepth getSaveMode isDefaultPrevented preventDefault getEventSource setSharedVariable and getSharedVariable
Xrm.Page.dataXrm.Page.data.refresh(boolSave).then(successCallback, errorCallback); Xrm.Page.data.save(saveOptions).then(successCallback, errorCallback);
Xrm.Page.data.entityattributes getDataXml getEntityName getId getIsDirty addOnSave and removeOnSave getPrimaryAttributeValue save
Xrm.Page.data.entity.attributes Xrm.Page.ui.controls Xrm.Page.ui.tabs Xrm.Page.ui Tab.sections Xrm.Page.ui Section.controls Xrm.Page.ui.navigation.items Xrm.Page.ui.formSelector.items Xrm.Page Attribute.controls Xrm.Page.data.process.getActivePath Xrm.Page.data.process.getActiveProcess [].getStages [].getStages[].getSteps collection.forEach(delegate function(attribute, index)) collection.get([String][Number][delegate function(attribute, index)]) collection.getLength()
Xrm.Page.data.entity.attributes Xrm.Page.getAttribute getInitialValue, getOption, getOptions, getSelectedOption = { text:'', value:'2145' }, and getText. controls getAttributeType getFormat getIsDirty getIsPartyList getMaxLength getName getParent getUserPrivilege getMax, getMin, and getPrecision addOnChange, removeOnChange, and fireOnChange setRequiredLevel(none|required|recommended) and getRequiredLevel setSubmitMode(always|never|dirty) and getSubmitMode getValue and setValue - for lookup: [{entityType:'', id:'', name:''}]
Xrm.Page.ui.controls Xrm.Page.getControl getDisabled and setDisabled getAttribute getName getParent getControlType = standard,iframe,lookup,optionset,subgrid,webresource,notes,timercontrol,kbsearch getLabel and setLabel Lookup control methods addCustomFilter var Sdk = window.Sdk || {}; Sdk.filterCustomerAccounts = function () { //Only show accounts with the type 'Preferred Customer' var customerAccountFilter = "<filter type='and'><condition attribute='accountcategorycode' operator='eq' value='1'/></filter>"; Xrm.Page.getControl("parentaccountid").addCustomFilter(customerAccountFilter, "account"); } //set 'Sdk.setParentAccountIdFilter' in the Opportunity form onload event handler Sdk.setParentAccountIdFilter = function () { Xrm.Page.getControl("parentaccountid").addPreSearch(Sdk.filterCustomerAccounts); } addCustomView(viewId, entityName, viewDisplayName, fetchXml, layoutXml, isDefault), getDefaultView, setDefaultView(viewGuid). You can add or remove event handlers for the PreSearch Event using the addPreSearch and removePreSearch methods. setNotification and clearNotification addOption, clearOptions and removeOption setShowTime and getShowTime getVisible and setVisible subgrid_control.refresh subgrid_control.addOnLoad, subgrid_control.removeOnLoad subgrid_control.getViewSelector ViewSelector.getCurrentView and setCurrentView GridControl.getGrid Grid.getRows Grid.getSelectedRows GridRow.getData GridRowData.getEntity, GridEntity.getEntityReference WebResource and IFrame methods: getData, setData, getInitialUrl, getObject, setSrc and getSrc
Xrm.Page.data.processgetActiveProcess and setActiveProcess getActiveStage and setActiveStage getActivePath getEnabledProcesses getSelectedStage addOnStageChange, removeOnStageChange, addOnStageSelected, and removeOnStageSelected moveNext, movePrevious to move to the previous stage Process methods getId, getName, getStages, isRendered Stage methods getCategory().getValue(), getEntityName, getId, getName, getStatus, getSteps Step methods getAttribute, getName, isRequired
Xrm.Page.uiclose controls formSelector.getCurrentItem getId, getLabel, navigate formSelector.items getCurrentControl getFormType = 0-Undefined,1-Create,2-Update,3-Read Only,4-Disabled,6-Bulk Edit navigation.items setFormNotification(message, ERROR|WARNING|INFO, uniqueId) and clearFormNotification(uniqueId) refreshRibbon tabs getViewPortHeight and getViewPortWidth
Xrm.Page.ui sectioncontrols getName getParent getLabel and setLabel getVisible and setVisible
Xrm.Page.ui tabsections getName getParent getLabel and setLabel getVisible and setVisible setFocus getDisplayState and setDisplayState(expanded|collapsed)
Xrm.Page.ui.navigationgetId setFocus getLabel and setLabel getVisible and setVisible
Xrm.Page.ui.processsetDisplayState and setDisplayState(expanded|collapsed) getVisible and setVisible
Xrm.UtilityalertDialog(message,onCloseCallback) confirmDialog(message,yesCloseCallback,noCloseCallback) isActivityType(entityName) openEntityForm var parameters = {}; parameters["formid"] = "b053a39a-041a-4356-acef-ddf00182762b"; parameters["name"] = "Test"; parameters["telephone1"] = "(425) 555-1234"; Xrm.Utility.openEntityForm("account", null|ID, parameters,{ openInNewWindow: true }); openQuickCreate(entityLogicalName,createFromEntity,parameters).then(successCallback, errorCallback); var thisAccount = { entityType: "account", id: Xrm.Page.data.entity.getId() }; var callback = function (obj) { console.log("Created new " + obj.savedEntityReference.entityType + " named '" + obj.savedEntityReference.name + "' with id:" + obj.savedEntityReference.id); } var setName = { name: "Child account of " + Xrm.Page.getAttribute("name").getValue() }; Xrm.Utility.openQuickCreate("account", thisAccount, setName).then(callback, function (error) { console.log(error.message); }); openWebResource(webResourceName,webResourceData,width, height) var customParameters = encodeURIComponent("first=First Value&second=Second Value&third=Third Value"); Xrm.Utility.openWebResource("new_webResource.htm",customParameters);
Open forms, viewshttp://mycrm/myOrg/main.aspx?etn=account&pagetype=entityrecord http://myorg.crm.dynamics.com/main.aspx?etn=account&pagetype=entityrecord&id=%7B91330924-802A-4B0D-A900-34FD9D790829%7D http://mycrm/myOrg/main.aspx?etn=&pagetype=entityrecord|entitylist&id=&viewid=&viewtype=1039|4230&navbar=on|off|entity &cmdbar=true|false&extraqs=encodeURIComponent("address1_addresstypecode=3&telephone1=9165558899") function getReportURL(action,fileName,id) { var orgUrl = GetGlobalContext().getClientUrl(); var reportUrl = orgUrl + "/crmreports/viewer/viewer.aspx?action=" + encodeURIComponent(action) + "&helpID=" + encodeURIComponent(fileName) + "&id=%7b" + encodeURIComponent(id) + "%7d"; return reportUrl; "%7d"; return reportUrl; }
OData http://crmrestbuilder.codeplex.com/ http://xrmservicetoolkit.codeplex.com /wikipage?title=Soap%20Functions var account = {}; account.Name = "Sample Account"; var jsonAccount = window.JSON.stringify(account); $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", datatype: "json", url: Xrm.Page.context.getClientUrl() + "/XRMServices/2011/OrganizationData.svc/AccountSet", data: jsonAccount, beforeSend: function (XMLHttpRequest) { //Specifying this header ensures that the results will be returned as JSON. XMLHttpRequest.setRequestHeader("Accept", "application/json"); }, success: function (data, textStatus, XmlHttpRequest) { account = data.d; }, error: function (XMLHttpRequest, textStatus, errorThrown) { errorHandler(XMLHttpRequest, textStatus, errorThrown); } });

Комментариев нет: