GithubHelp home page GithubHelp logo

delegateas / xrmdefinitelytyped Goto Github PK

View Code? Open in Web Editor NEW
133.0 35.0 53.0 3.89 MB

Tool to generate TypeScript declaration files for Dynamics 365/CDS client-side coding.

Home Page: http://delegateas.github.io/Delegate.XrmDefinitelyTyped/

License: MIT License

Batchfile 0.11% F# 42.73% PowerShell 0.02% JavaScript 13.89% TypeScript 43.25%
typescript dynamics-365 dynamics-crm developer-tools developer-experience

xrmdefinitelytyped's People

Contributors

altman-medline avatar daryllabar avatar dependabot[bot] avatar emilielildholdt avatar forki avatar henrikhannemose avatar jonatangranner avatar joshcampbell191 avatar kennyvaes avatar knethm avatar lawsl avatar loeka1234 avatar magesoe avatar majakubowski avatar matejskubic avatar mathiasbl avatar mdocter avatar misoeli avatar mkholt avatar mktange avatar mlr-dg avatar oliverflint avatar san-86 avatar sergeytunnik avatar sigurdthorlund avatar skovlund avatar tommalow avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xrmdefinitelytyped's Issues

Can't build the project

Hello,
I'm sure this is due to my novice status as a developer and complete unfamiliarity with F#, but I can't get the project to build.

  • I'm running VS 2015.
  • I've installed F# tools for VS2015 and the Java SDK.
  • I've installed TypeScript globally.
  • I went to .paket/ and ran the bootstrapper, then ran .paket/paket.exe (Is that supposed to be part of the build steps? lf so, it would be helpful in the readme for noobs like me)
  • I ran Build (Ctrl+Shift+B in VS2015).
    The results:
    ------ Build started: Project: XrmDefinitelyTyped, Configuration: Debug Any CPU ------
    tsc -p C:\Repos\XrmDefinitelyTyped\src\XrmDefinitelyTyped\Resources
    java -jar C:\Repos\XrmDefinitelyTyped\src\XrmDefinitelyTyped....\tools\closure\compiler.jar --js C:\Repos\XrmDefinitelyTyped\src\XrmDefinitelyTyped\Resources\Dist\dg.xrmquery.rest.js --js_output_file C:\Repos\XrmDefinitelyTyped\src\XrmDefinitelyTyped\Resources\Dist\dg.xrmquery.rest.min.js
    EXEC: error : Unable to access jarfile C:\Repos\XrmDefinitelyTyped\src\XrmDefinitelyTyped....\tools\closure\compiler.jar
    C:\Repos\XrmDefinitelyTyped\src\XrmDefinitelyTyped\XrmDefinitelyTyped.fsproj(153,5): error MSB3073: The command "java -jar C:\Repos\XrmDefinitelyTyped\src\XrmDefinitelyTyped....\tools\closure\compiler.jar --js C:\Repos\XrmDefinitelyTyped\src\XrmDefinitelyTyped\Resources\Dist\dg.xrmquery.rest.js --js_output_file C:\Repos\XrmDefinitelyTyped\src\XrmDefinitelyTyped\Resources\Dist\dg.xrmquery.rest.min.js" exited with code 1.
    Done building project "XrmDefinitelyTyped.fsproj" -- FAILED.

Build FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Now, the cause is obvious: the files the script attempts to access aren't there. But that must mean I'm missing a step or doing one incorrectly (or both). Either explicit instructions for this project or a reference to general instructions on building an F# project would be greatly appreciated.

tsconfig typeRoots

Do you know how to get tsconfig "typeRoots" working? Here's what I have:
{
"compileOnSave": true,
"typeAcquisition": {
"enable": false
},
"compilerOptions": {
"outDir": "js",
"target": "es5",
"sourceMap": true,
"typeRoots": [
"./typings/",
"./node_modules/@types"
],
"types": [
"XRM",
"jquery"
]
},
"include": [
"./ts/**/
"
]
}

I get intellisense for jquery, but not your typings.

How to handle localization messages

Currently I'm using a seperate res.js file where I store messages in multiple languages similar to this guide https://msdn.microsoft.com/en-us/library/hh670609.aspx.

This file looks like this:

var pcnRes = {
    ApproveWaiting: {
        _1033: "English message",
        _1031: "German message"
    },
    ApproveFailed: {
        _1033: "English message",
        _1031: "German message."
    }
}

This allows me to access those message in my main Javascript code with just one line of code:

Xrm.Page.ui.setFormNotification(pcnRes.ApproveWaiting["_" + languageId], "INFO", "someID");

I'm currently writing new script code with XrmDefinitelyTyped and therefore Typescript. I've simply tried to rename my res.js file to res.ts but then I have to write multiple conditions in my main code to differentiate between languages:

if (Page.context.getUserLcid() == 1031) {
    Page.ui.setFormNotification(pcnRes.ApproveWaiting._1031, "INFO", "someID");
}
else {
    Page.ui.setFormNotification(pcnRes.ApproveWaiting._1033, "INFO", "someID");
}

Anyone knows of a better way to handle this?

Datetime attributes are not included in Declaration files Is it just datetimefields?

I have form with Seven attributes on them. I have published my customisations.
not all attributes added to declaration files
UPRN: Of type string
Status: Of type Status
Status Reason: Status Reason
X CoOrdinate: Decimal
Y CoOrdinate: Decimal
Start Date: Datetime
End Date: Datetime

Here is the attributes interface taken from Information.d.ts for Main form of blpu
Here you'll see that StartDate and End Date is missing also the Statecode and statusreason codes are also missing but referenced from a different def file.

declare namespace Form.hive_blpu.Main {
  namespace Information {
    namespace Tabs {
    }
    interface Attributes extends Xrm.AttributeCollectionBase {
      get(name: "hive_uprn"): Xrm.Attribute<string>;
      get(name: "hive_x_coordinate"): Xrm.NumberAttribute;
      get(name: "hive_y_coordinate"): Xrm.NumberAttribute;
      get(name: string): Xrm.EmptyAttribute;
      get(): Xrm.Attribute<any>[];
      get(index: number): Xrm.Attribute<any>;
      get(chooser: (item: Xrm.Attribute<any>, index: number) => boolean): Xrm.Attribute<any>[];
    }

Can you look into this please as we have many other forms with multiple attributes which has the same problem and this is blocking us from continuing

not all attributes added to declaration files2

Thanks

[Edit: added code formatting]

Type-safe way to create EntityReference

Hi everyone,

unless I missed something there is currently no type-safe way to create an EntityReference. This leaves room for errors like this:

Xrm.Page.getAttribute("new_language").setValue([{ id: languageId, entityType: "tv_langauge" }]);

(simple spelling mistake with two switched up letters: langauge =>language )

I can think of two better way of handling this:

  1. Introduce some sort of factory method that takes an EntityType as parameter:
let entityRef = Xrm.EntityReference.Create<New.EntityType>(id);
  1. Provide a constant for the type itself:
let entityRef = { id: id, entityType: New.Language.EntityType }

Would this be possible or feasible?

TypeScript 2.6 does not work with XrmQuery

When using TypeScript 2.6, there appears to be an issue with (at least) retrieveMultiple.

Running the example of retrieveMultiple from the wiki, we get an error since we cannot filter on an empty object:

RetrieveMultiple, empty object

The entire definition for retrieveMultiple appears to be broken (XrmQuery.retrieveMultiple<Account_Select, {}, {}, {}, {}, {}>(...))
XrmQuery.retrieveMultiple

What has changed with TypeScript 2.6 (I have not tested with TypeScript 2.5 to see if that works or not), and what can we do to make XrmQuery work?

Add support for multi-select option sets in D365 9.0

In the July update for Dynamics 365 multi-select option sets have been introduced. It appears that they have been implemented as an array of enum-values:

Multi-select option sets supports all the client APIs supported for the option sets attributes and controls; the only difference is that the return value of certain methods will be an array instead of a single value.

Add support to XrmDefinitelyTyped for this new data type.

A corresponding issue has been created for XrmContext.

Incorrect generated definition when Navigation Property Name is not set

It can happen that the attribute ReferencingEntityNavigationPropertyName in relationship metadata is not set which will result in incorrect TypeScript definition files being generated as seen in the example below.

interface PostFollow_Relationships {
  ?: hph_projekt_Result | null;
  1?: hph_tilbud_Result | null;
  2?: Competitor_Result | null;
  regardingobjectid_account?: Account_Result | null;
  regardingobjectid_appointment?: Appointment_Result | null;
  regardingobjectid_contact?: Contact_Result | null;
  regardingobjectid_incident?: Incident_Result | null;
  regardingobjectid_lead?: Lead_Result | null;
  regardingobjectid_opportunity?: Opportunity_Result | null;
  regardingobjectid_phonecall?: PhoneCall_Result | null;
  regardingobjectid_systemuser?: SystemUser_Result | null;
  regardingobjectid_task?: Task_Result | null;
}

These relations are auto generated by microsoft by somehow. the navigation name is null in the metadata. It is also possible to rename these navigation name through the Web API.

XrmDefinitelyTyped should be updated to handle the case where navigation name is null by either adding a "isnotset" or "isnull" stand-in name, or alternatively, not including these relationship at all.

Errors in xrm.d.ts for D365 9.0

When running XrmDefinitelyTyped against a 9.0 instance, the generated xrm.d.ts has errors. It refers to Xrm.Utility, which does not exist:

interface Xrm<T extends Xrm.PageBase<Xrm.AttributeCollectionBase, Xrm.TabCollectionBase, Xrm.ControlCollectionBase>> extends BaseXrm {
    [...]
    Utility: Xrm.Utility;
}


declare namespace Xrm {
    var Utility: Utility;
    [...]
}

Xrm.Utility has been deprecated in v9. By setting the useDeprecated flag when running XrmDefinitelyTyped, we are able to generate a working xrm.d.ts (but that is only a work-around).

RetrieveMultiple Filter.equals Guid

I've encountered a problem today with the retrieve multiple function.

I am trying to retrieve multiple records of my intersection entity that match the GUID of the currently open record:

XrmQuery.retrieveMultiple(x => x.skd_customernotification_navcompanyset)
    .select(x => [x.skd_customernotificationid])
    .filter(x => Filter.equals(x.skd_customernotificationid, Page.data.entity.getId()))
    .execute(navCompanies => {
        // Do something
        }
    }, x => errorHandler(x.message))

Problem is x.skd_customernotifcationid is of type XQW.Guid while Page.data.entity.getId() is of type string. When I try to cast the string to a guid like:

Filter.makeGuid(Page.data.entity.getId());

I still get the following error:
A binary operator with incompatible types was detected. Found operand types 'Edm.Guid' and 'Edm.String' for operator kind 'Equal'."

Am I doing something wrong?

Static-/Basic-Page for non-formspecific scripts

Hi Guys,
is it possible to add the default XRM-Objectmodel functions (for instance XRM.Page.getControl()) in xrm.d.ts so that they're usable in non form-specific scripts (utlity-classes)? I've extended the xrm.d.ts with some of these functions by myself but i've to copy&paste after every new metadata-generation.

Another great option would be the possibility to rename the default Namespace from Xrm to something else.

Thanks,
Alex

Run.ps1 relative execution directory incorrect

The Run.ps1 script may be run in a couple of ways.
Running it in PowerShell ISE or PowerShell Console directly will have the working directory set to the script directory and the script works fine.

However, if executing from Visual Studio using the context menu's "Execute as Script", the working directory is the current project's directory and execution fails.

A slight modification to Run.ps1 fixes this:

Push-Location (split-path $SCRIPT:MyInvocation.MyCommand.Path -parent)
.\XrmDefinitelyTyped.exe

This ensures that the working directory is always the same as the script directory and will work regardless of executing from command line or from Visual Studio context menu.

Access to header controls should not appear in CRM 2011

Microsoft's documentation: https://msdn.microsoft.com/en-us/library/jj602964.aspx

Controls in the header follow the naming convention where “header_” is prepended to the name of the control. For example, if the name attribute is in the header you can access it using:
var nameControlInHeader = Xrm.Page.getControl("header_name");

However, this was introduced in CRM 2013: https://arunpotti.wordpress.com/2014/11/08/enable-disable-header-field-on-crm-form-2013/
In CRM 2011 we have to use this workaround: http://vikramxrm.blogspot.dk/2013/10/how-to-getset-form-header-field-in-ms.html

Form methods after 2011 should not appear in CRM 2011

Taken from a comment on #16

The following methods shouldn't be suggested when using CRM 2011.

Introduced in CRM 2013:
Xrm.Utility.isActivityType
Xrm.Page.context.getUserName
Lookup: Xrm.Page.getControl(arg).addPreSearch
Lookup: Xrm.Page.getControl(arg).removePreSearch
"then" method (interface Then) only makes sense after async refresh or save.

Introduced in CRM 2015:
Xrm.Utility.openQuickCreate
Xrm.Page.context.getIsAutoSaveEnabled
Xrm.Page.context.getTimeZoneOffsetMinutes
DateTime: Xrm.Page.getControl(arg).getShowTime
Subgrid: Xrm.Page.getControl(arg).getRelationshipName
Xrm.Page.ui.process.xyz and Xrm.Page.data.process.xyz only makes sense with business process flows. It seems that interfaces with names containing "process" or "stage" are not needed in CRM 2011. And possibly "interface DataModule".

Suggestion

Hello there, first I would like to thank you for this awesome tool.

I have a small suggestion; is it possible to add an option to omit get(name: string): Xrm.EmptyAttribute; and get(name: string): Xrm.EmptyControl; that way we can only use valid attribute/control names with Xrm.Page.getAttribute and Xrm.Page.getControl.

What do you think?

Add support for deprecation of fields

It is possible to deprecate fields in XrmContext by specifying a prefix, such as "X_", that is added to the display name of the deprecated field. The same feature would be useful in XrmDefinitelyTyped.
However, TypeScript does not currently support deprecation but it is still possible to introduce it through union types.

We could introduce a new type called deprecated and use it as part of the union type of the deprecated field. Say for example that we have a deprecated text field, the generated definition for the field could then have the type string | null | deprecated. This will introduce a compile time error which the user needs to handle. Either by stop using the field og discard the type and insist on using the field even though it is deprecated.

This new feature should be optional and activated the same way as it is done in XrmContext, by adding an additional argument specifying the deprecated prefix. For example "deprecatedprefix", "X_"

XrmQuery: Unable to properly parse function

Hi,

I just found this awesome project and tried it today. Not sure if this is a bug or I am doing something wrong, but I tried to use the Web API lib to retrieve an account on the Opportunity form like this:

const accountLookup = Xrm.Page.getAttribute("parentaccountid").getValue();

const account = await XrmQuery.retrieve(x => x.accounts, accountLookup[0].id)
	.select(x => [x.accountnumber])
	.promise();

When I execute this, I get the following error message:

Uncaught (in promise) Error: XrmQuery: Unable to properly parse function: x => x.accounts
at f (tv_xrmquery.web.js?ver=-1324898337:1)
at h (tv_xrmquery.web.js?ver=-1324898337:1)
at c (tv_xrmquery.web.js?ver=-1324898337:1)
at Function.e.Get (tv_xrmquery.web.js?ver=-1324898337:1)
at Object.t.retrieve (tv_xrmquery.web.js?ver=-1324898337:1)
at tv_opportunity.js?ver=-1324898337:23
at Generator.next ()
at tv_opportunity.js?ver=-1324898337:6
at new Promise ()
at __awaiter (tv_opportunity.js?ver=-1324898337:2)

I added the dg.xrmquery.web.promise.min.js file as "tv_xrmquery.web.js" web resource to the opportunity form.

Am I doing something wrong or is this a bug?

Cheers
Michael

XrmQuery: Debug sending dates to CRM

When sending an update to CRM using XrmQuery containing a date value, we get the following error:

An unexpected 'StartObject' node was found for property named 'lastusedincampaign' when reading from the JSON reader. A 'PrimitiveValue' node was expected.

It appears that we actually send an empty object to CRM (the following is the result of looking at the outgoing call with Fiddler):

{"lastusedincampaign":{}}

Are we missing some conversion of the date object to JSON before sending it to CRM? Additionally, are different formats required depending on the type of the field in CRM (Date Only vs. Date and Time)?

The sample code I used for testing is:

XrmQuery.update(x => x.accounts, "6786C6EB-DE6D-E611-80DF-C4346BADF080", { lastusedincampaign: new Date() })
    .execute(x => { });

This was originally found through a StackOverflow-post: xrmquery.update -> update crm date field

Provide `.promise()` functions to the old endpoint along with promise-polyfilled library

Similar to XrmQuery for the Web API, the old endpoint should also have .promise() functions next to their .execute() functions, which returns a ES6 Promise instead of relying on callbacks.

A new JavaScript library file should also be generated which includes a promise polyfill (dg.xrmquery.rest.promise.min.js), just like it is for the Web API version.

Add support for Quick View Forms

When a Quick View Form is added to a form, the controls from the Quick View Form can be accessed in the following manner: Xrm.Page.getControl("quickViewFormName_quickViewFormName_relatedEntityName_fieldName"). This is currently not supported by XrmDefinitelyTyped.

Support for getting the controls from a Quick View Form could be added to XrmDefinitelyTyped. The attributes returned from getAttribute would possibly not have setValue available, since that is not supported as mentioned on MSDN:

The constituent controls within a quick view control are included in the controls collection and these controls have the getAttribute method. However, the attribute is not part of the attribute collection for the entity. While you can retrieve the value for that attribute using getValue and even change the value using setValue, changes you make will not be saved with the entity.

Examples

Hi, could you please add more examples? For example how to create a record with XrmQuery etc. Thanks

Strongly typed filter xml for Custom Filter on lookupfields

It is possible to add a custom filter to the lookup fields search on forms. Currently this is done with a string constructed as a filter XML that are found in FetchXML.

We might be able to reuse XrmQuery's Filter methods to create the filter structure and convert it to XML.

Be Able To Define Custom Interface Definition Creation

Null Safe Code like this is really annoying

var att = Xrm.Page.getAttribute("name");
if(att){
    att.setValue("someValue");
}

Which is why I've seen lots of people creator nullsafe helper functions:

MyLibrary.setValue("name", "someValue");

These functions may log if the attribute isn't on the form, but it won't throw a null ref exception.

Is there a way to get the generated d.ts files, to create interface definitions for these custom library calls?

Typings for standard and custom actions

The Web API supports calling both standard and custom actions as seen in the docs.

We need to support both bound and unbound actions, which will likely need two different function calls in XrmQuery to work properly with how the queries are constructed.

Unbound actions

Not bound to a specific entity, and just needs an object with the input fields for the action. This is the simpler version to implement.

Function in XrmQuery:

XrmQuery.unboundAction(x => x.WinOpportunity)
  .executeWith({ 
    Status: opportunity_statuscode.Won,
    OpportunityClose: {
      subject: "Won Opportunity",
      opportunityid_bind$opportunities: "b3828ac8-917a-e511-80d2-00155d2a68d2"
    }
  });

Which will result in the following request:

POST [Organization URI]/api/data/v8.2/WinOpportunity HTTP/1.1
Accept: application/json
Content-Type: application/json; charset=utf-8
OData-MaxVersion: 4.0
OData-Version: 4.0

{
 "Status": 3,
 "OpportunityClose": {
  "subject": "Won Opportunity",
  "[email protected]": "[Organization URI]/api/data/v8.2/opportunities(b3828ac8-917a-e511-80d2-00155d2a68d2)"
 }
}

The return value is to be typed as the corresponding interface which describes the response of calling the action (or undefined/void if none).

Bound actions

Bound to a specific entity, which means we also need the logical name(s) and GUID of the record besides the action name.

Function in XrmQuery:

XrmQuery.boundAction(x => x.AddToQueue, x => x.queues, "56ae8258-4878-e511-80d4-00155d2a68d1")
  .executeWith({
    Target: {
      activityid: "59ae8258-4878-e511-80d4-00155d2a68d1",
      $type: "letter"
 }
});

It may be possible/necessary to have use one of the following signatures instead:

XrmQuery.boundAction(x => x.AddToQueue, "queues", "56ae8258-4878-e511-80d4-00155d2a68d1")
XrmQuery.boundAction(x => x.AddToQueue_$queues, "56ae8258-4878-e511-80d4-00155d2a68d1")

The call should result in the following request:

POST [Organization URI]/api/data/v8.2/queues(56ae8258-4878-e511-80d4-00155d2a68d1)/Microsoft.Dynamics.CRM.AddToQueue HTTP/1.1
Accept: application/json
Content-Type: application/json; charset=utf-8
OData-MaxVersion: 4.0
OData-Version: 4.0

{
 "Target": {
  "activityid": "59ae8258-4878-e511-80d4-00155d2a68d1",
  "@odata.type": "Microsoft.Dynamics.CRM.letter"
 }
}

Type Save getting of an Attribute

How can this

_form = <Form.gb_request.Main.Informatie>executionContext.getFormContext();

const invalidLotCount = _form.getAttribute("gb_invalidlotscount");

Become

_form = <Form.gb_request.Main.Informatie>executionContext.getFormContext();

const invalidLotCount = _form.getAttribute(gb_request.gb_invalidlotscount);

Cannot retrieveMultiple with filtering by entity reference using WebApi

        XrmQuery.retrieveMultiple(x => x.accounts)
            .select(x =>[ x.name])
            .filter(x => Filter.equals(x.primarycontactid_guid, Filter.makeGuid("test")))
            .execute(records => function () { }, function (error)
            {
                alert(error);
            });

        XrmQuery.REST.retrieveMultipleRecords(x => x.Account)
            .select(x => [x.Name])
            .filter(x => Filter.REST.equals(x.PrimaryContactId.Id, Filter.REST.makeGuid("test")))
            .execute(records => function ()
            {
                alert(records);
            },
            function (error)
            {
                alert(error);
            },null);

I have two queries - first one using webapi and second one - using rest endpoint.
Second one works fine but the first one returns error:
{ "error":{ "code":"","message":"Could not find a property named 'primarycontactid_guid' on type 'Microsoft.Dynamics.CRM.account'.","innererror":{ "message":"Could not find a property named 'primarycontactid_guid' on type 'Microsoft.Dynamics.CRM.account'.","type":"Microsoft.OData.Core.ODataException","stacktrace":" w Microsoft.OData.Core.UriParser.Parsers.EndPathBinder.GeneratePropertyAccessQueryForOpenType(EndPathToken endPathToken, SingleValueNode parentNode)\r\n w Microsoft.OData.Core.UriParser.Parsers.EndPathBinder.BindEndPath(EndPathToken endPathToken)\r\n w Microsoft.OData.Core.UriParser.Parsers.MetadataBinder.Bind(QueryToken token)\r\n w Microsoft.OData.Core.UriParser.Parsers.BinaryOperatorBinder.GetOperandFromToken(BinaryOperatorKind operatorKind, QueryToken queryToken)\r\n w Microsoft.OData.Core.UriParser.Parsers.BinaryOperatorBinder.BindBinaryOperator(BinaryOperatorToken binaryOperatorToken)\r\n w Microsoft.OData.Core.UriParser.Parsers.MetadataBinder.Bind(QueryToken token)\r\n w Microsoft.OData.Core.UriParser.Parsers.FilterBinder.BindFilter(QueryToken filter)\r\n w Microsoft.OData.Core.UriParser.ODataQueryOptionParser.ParseFilterImplementation(String filter, ODataUriParserConfiguration configuration, IEdmType elementType, IEdmNavigationSource navigationSource)\r\n w Microsoft.OData.Core.UriParser.ODataQueryOptionParser.ParseFilter()\r\n w System.Web.OData.Query.FilterQueryOption.get_FilterClause()\r\n w Microsoft.Crm.Extensibility.OData.DataQueryOptionsConverter.SetFilterExpression(QueryExpression qe, FilterQueryOption filterQueryOption)\r\n w Microsoft.Crm.Extensibility.OData.QueryOptionsConverterBase4.GetQueryExpression(ODataQueryOptions queryOptions, String edmEntityName, CrmODataExecutionContext context)\r\n w Microsoft.Crm.Extensibility.OData.CrmODataServiceDataProvider.RetrieveEdmEntityCollection(CrmODataExecutionContext context, String entityCollectionName, String castedEntityName, ODataQueryOptions queryOptions)\r\n w Microsoft.Crm.Extensibility.OData.EntityController.GetEntitySetInternal(String entitySetName, String castEntityName, CrmODataExecutionContext context, CrmEdmEntityObjectCollection crmEdmEntityObjectCollection, ODataQueryOptions queryOptions)\r\n w Microsoft.Crm.Extensibility.OData.EntityController.GetEntitySet(String entitySetName)\r\n w lambda_method(Closure , Object , Object[] )\r\n w System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)\r\n w System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary2 arguments, CancellationToken cancellationToken)\r\n--- Koniec \u015bladu stosu z poprzedniej lokalizacji, w kt\u00f3rej wyst\u0105pi\u0142 wyj\u0105tek ---\r\n w System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n w System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n w System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()\r\n--- Koniec \u015bladu stosu z poprzedniej lokalizacji, w kt\u00f3rej wyst\u0105pi\u0142 wyj\u0105tek ---\r\n w System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n w System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n w System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()\r\n--- Koniec \u015bladu stosu z poprzedniej lokalizacji, w kt\u00f3rej wyst\u0105pi\u0142 wyj\u0105tek ---\r\n w System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n w System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n w System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()" } } }

I'm using Dynamics CRM 2016 and tested it with api 8.0 and 8.1`
Generated request url is

v8.1/accounts?$select=name&$filter=primarycontactid_guid%20eq%20test

XrmQuery.REST

I have a problem using XrmQuery.REST.createRecord method, intellisense does not yield any suggestions and I'm unable to select any RestMapping (x.Account for example) while retrieveMultipleRecords is working just fine. (Screenshot below).

Are we doing something wrong or is there a problem to solve somewhere?

image

Edit: This is my config file

image

Edit: Turns out it was an intellisense issue. Best regards.

Remove Guid Parenthesis in XrmQuery

I just tried to fire this Query:

XrmQuery.retrieve(x => x.products, product[0].id)
                .select(x => [x.productid])
                .includeFormattedValues()
                .execute(product => {
// Do something
}

Always got an error until I finally figured out to remove the curly brackets from the product[0].id. Wouldn't it be nice when the XrmQuery functions would automatically do that?

Xrm.WebApi.updateRecord function has wrong parameter type

There is a definition in xrm.d.ts file under Xrm.WebApiBase interface for updateRecord
updateRecord(entityLogicalName: string, id: string, data: string): Then;

When I put data as an object as it is stated here:
https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi/updaterecord
, there is an error during build in VS: Build:Argument of type '{ "name": string; }' is not assignable to parameter of type 'string'.

Your definition expects data as a string, when I put there something like JSON.stringify({"name":"newName"}) and deploy to crm,
I get error: An unexpected 'PrimitiveValue' node was found when reading from the JSON reader. A 'StartObject' node was expected.

So this should be changed to:
updateRecord(entityLogicalName: string, id: string, data: any): Then;
..because webApi internally call JSON.stringify already.

Could you please change createRecord as well?
createRecord(entityLogicalName: string, data: any): Then;

Thanks.

Generate typings for fields added as web resource dependencies in D365 9.0

In D365 9.0 a new concept has been introduced: Web Resource Dependencies.

When a JavaScript web resource used in a form script is associated to an attribute for a specific entity, that entity attribute will be available to the script even when a field for that attribute isn’t included in the form.

I am not currently aware of whether or not we can access these dependencies from the API, and whether this is something we want to support. In that case, we should look at generating web resource specific typings.

New project: Can't build

After running XrmDefinitelyTyped.exe tool, can't compile:

Error 106 Could not find symbol 'Xrm'. C:\Users\mcerdeira\Desktop\SDK\MC\TypeScriptHTMLApp1\TypeScriptHTMLApp1\typings\XRM\Form\account\Main\Information.d.ts 74 41 Information.d.ts

I started the project as:

image

I don´t know what am I doing wrong.

xrm.d.ts - missing properties ?

Xrm.

Hi.
I'm trying to use XrmDefinitelyTyped tool (2.5.2) version against Dynamics 365 9.0 ogranization (on-line).
However I have realized that there are some properties missing inside generated xrm.d.ts file.
For example:

  1. There is no var Page: Xrm.PageBase<Xrm.AttributeCollectionBase, Xrm.TabCollectionBase, Xrm.ControlCollectionBase> property inside Xrm namespace (and interface).
  2. PageBase interface does not have a context (Xrm.context) property.

I'm not sure is something not working correctly (or I'm doing something wrong) or maybe the programming model for generated definitions has changed in this version (if so - is there any documentation available?)?

I'm attaching my generated xrm.d.ts file (zipped) to this report.
xrm.d.ts.zip

Missing fields in generated typings

I have a custom activity entity with one Main form (Information), one mobile express form and one quick view form. When I generate the typings, all custom fields and sections on the Information form are not detected and not present in the typescript definitions. Those are all the fields that are generated:
image
image

However, when I create a copy of Information form using save as, and regenerate the typings I get all the fields and sections like I expect:
image
image

Deleting the copy form, and regenerating the typings results in missing fields problem again.

I noticed the form version is 0.1, and the copy form created using save as has version 0.4 (Maybe because this solution was upgraded from CRM2015), but the question is why does creating a copy of the Information form actually help with properly generating field typings?

How can I help you pinpoint the issue?

Thanks in advance

Update 1:
I just deleted the old information form (version 0.1) and kept the copy (version 0.4), typings are now being generated properly. Please just close this issue if you have no interest in further debugging.
Thank you for your efforts.

Retrieve using alternate key

In the Web API you can retrieve records using alternate keys instead of GUIDs, as seen in the docs.

How the function call could look like:

XrmQuery.retrieveAlt(x => x.accounts_$MyAltKey).executeWith({ accountnumber: "123" })

This call should of course provide some of the same functionality as the regular XrmQuery.retrieve() function in XrmQuery, such as selecting and expanding attributes.

Xrm.Page

I've followed the tutorial but haven't got a Xrm.Page.

Add missing methods to CRM 2011 regarding Outlook

Taken from a comment in #16

In CRM 2013 these two methods have been replaced by getClient and getClientState, but they are perfectly valid in CRM 2011. They need to be added.
Xrm.Page.context.isOutlookClient
Xrm.Page.context.isOutlookOnline

Error when using lookup attribute inside a filter on XrmQuery

When a filter in XrmQuery tries to access a lookup value, the logicalname and type is invalid. For example, a field with the logicalname "dg_parent" actually has the logicalname "_dg_parent_value". This is currently supported in select, but has yet to be added inside filter.

XrmQuery: Retrieve returns name field with added "1" for custom entity

Hi everyone,

I just ran into a strange problem: I wanted to query a custom "Country" entity using XrmQuery Web API like this:

const country = await XrmQuery.retrieve(x => x.tv_countries, countryValue.id)
    .select(x => [ x.tv_country ]) // Name attribute of the entity
    .promise();

But this lead to an error:

Could not find a property named 'tv_country' on type 'Microsoft.Dynamics.CRM.tv_country'.

Curious, I made a select retrieving all properties of tv_country once using XrmQuery and once using my Browser which resulted in the following curiosity:

// XrmQuery
{
    tv_country1: "United States",
    // ...
}

// Browser
{
    tv_country: "United States",
    // ...
}

XrmQuery has added a "1" to the name field of the entity. My best guess would be this is due to the property and entity sharing their name (tv_country). For other custom entities the name field has a "name" suffix and no such problems occur. I have no idea why the name field does not have a name suffix for countries as well.

Is this a bug in XrmQuery or is there something wrong with the country entity?

Latest version of XrmDefinitelyTyped is not generating definitions

When I attempt to execute the latest XrmDefinitelyTyped exe using the same config as the previous version I get an error message Unable to generate TypeScript files: access to path "X" is denied

Where X is path + \WebResources\typings\XRM_internal\Enum\Folder
Where Folder is the name of the folders of the entities in the solution / entities specified in the config
eg Folder hive_blpu.statecode.d.ts = Entity name hive_blpu.statecode

Any ideas why?

Attribute "directioncode" gets type number instead of boolean in Form.phonecall

The attribute "directioncode" is of type boolean on all other activities. However, on phonecall forms the type is number. Interfaces PhoneCall_Base, PhoneCall_Select and PhoneCall_Filter correctly show "directioncode" as boolean.

get(name: "directioncode"): Xrm.OptionSetAttribute< number>;
get(name: "directioncode"): Xrm.OptionSetControl< number>;
getAttribute(attributeName: "directioncode"): Xrm.OptionSetAttribute< number>;
getControl(controlName: "directioncode"): Xrm.OptionSetControl< number>;

interface PhoneCall_Base extends WebEntity {
...
directioncode?: boolean | null;
...
}

interface PhoneCall_Select {
...
directioncode: WebAttribute<PhoneCall_Select, { directioncode: boolean | null }, { }>;
...
}

interface PhoneCall_Filter {
...
directioncode: boolean;
...
}

XrmQuery.update not working?

I'm trying to use the XrmQuery.update function:

            var entity: skd_customernotification = {
                statuscode: skd_customernotification_statuscode.Approved,
                skd_approvedon: new Date(),
                skd_ApprovedBy_bind$systemusers: "/systemusers(" + Page.context.getUserId() + ")"
            };

            XrmQuery.update(x => x.skd_customernotifications)
                .setData(Page.data.entity.getId(), entity)
                .execute(x => {
                    displayNotificationWithTimeout("Approved", "INFO", "id", 5000)
                }, x => {
                    errorHandler(x.message)
                })

I'm always getting the message that there is an error in the query syntax.

If I output the query string I don't see any data from my entity:

var test = XrmQuery.update(x => x.skd_customernotifications)
                .setData(Page.data.entity.getId(), entity)
                .getQueryString();

Am I doing something wrong?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.