As mentioned in the blog below, could the attribute, _bpf_accountid_value be used when not found in the default solution? Trying something similar with leads, I am trapping the error "the given key not present in dictionary".
I am on the lead form and for testing purposes I traverse the BPF and without manually finishing it,
I am trying to make my custom workflow "Finish" it, on demand.
I hesitate to show my code because it is commented with various attempts and will only loose the focus of this specific question.
Please help.
https://community.dynamics.com/365/b/crmmemories/posts/finish-a-business-process-flow-in-c
I just verified in my instance as the BPF will have its own entity, I can find those attributes. You can check too using CRM REST Builder or the native Advanced find - download fetchxml.
There is a difference between OOB like Lead entity BPF and custom entity BPF like below: (_bpf_xxx_projectinspectionsid_value vs _leadid_value)
https://crmdev.crm.dynamics.com/api/data/v9.1/xxx_inspectionflows(00000000-0000-0000-0000-000000000000)?$select=_bpf_xxx_projectinspectionsid_value,bpf_name,businessprocessflowinstanceid
https://crmdev.crm.dynamics.com/api/data/v9.1/leadtoopportunitysalesprocesses(00000000-0000-0000-0000-000000000000)?$select=businessprocessflowinstanceid,_leadid_value
Related
I was wondering if it is possible to write to the trace logs of a CRM 365 org from within a C# console application. I can and have done this successfully with a plugin, but haven't been able to find much information on writing to the trace log from a console application.
Figured I'd ask here, before I just use the orgservice to create a record in an entity and add the data that way.
I don’t think you can do it.
plugintracelog EntityType is supporting GET & DELETE only, no POST support. Also every single attribute is read-only. That being said it is an internal only use entity. Especially for plugins & WFs.
So create a custom entity & log everything.
Btw, Still you can mock it by implementing interface ITracingService.
Although I have never used it, the Microsoft.Xrm.Tooling.Connector namespace has some ability to configure tracing via the TraceControlSettings class, and other trace-related classes that the first link shows.
However, the example in this post indicates that it's for external tracing (i.e. to a file), rather than using the plugin trace mechanism.
Another commentary: Use Trace not Console
Many classes in the .NET framework (especially in the socket/network classes, which is what I'm looking at) use System.Net.GlobalLog (an internal class) to log trace messages somewhere. You can view example uses of things like GlobalLog.Assert and GlobalLog.Print in the SslState class:
SslStream source code
This is different from the System.Net.Logging (also internal) class, uses of which can also be found throughout the socket/network classes.
For System.Net.Logging, I know I can use a <system.diagnostics> configuration block in App.Config and that will result in System.Net.Logging messages getting logged if configured properly. However, this does not appear to influence System.Net.GlobalLog.
After searching around for about an hour, I cannot seem to find any information about locating the output of System.Net.GlobalLog. Does anyone know how to locate/view/control the output of this?
As you stated, GlobalLog is an internal class to the System.Net assembly. Without being able to modify the System.Net assembly you won't get access to that class.
That said, you might want to review the following: http://www.123aspx.com/rotor/RotorSrc.aspx?rot=42941
It looks like you have to have compiler flags TRAVE and DEBUG set in order to get it to work.. but I'm not seeing where it actually does anything with the logged information. The comments suggest that it is supposed to look for an environment variable setting and dump the log to a text file somewhere on the system; however the code at that page seems either incomplete or it simply wasn't finished.
My guess is that you need to find some other way of getting access to the logging info you want.
I don't have enough rep to put this as a comment on the existing answer but I wanted to figure out what was happening in the TcpClient and Socket classes but also found they couldn't be stepped into. The closest I got was by monitoring the Windows API calls that were being made. I used a freeware tool called API Monitor found here: http://www.rohitab.com/apimonitor.
I’m learning my way around ASP.NET MVC using vs2010 and .NET4 – nothing for production use, just for my own personal use.
I created a default ASP.NET MVC which comes with pre-existing home page, about page and login and registration pages. In attempting to use the existing login and registration pages I (not having an SQL server) replaced the SQLMembershipProvider with the MySQLMembershipProvider found in Connector/NET in the MySQL.Web.Security.
However this didn’t work straight away, aside from the common issue people seemed to have with autogeneration of the schema (solved by googling) I had two other problems that I noticed.
The first was that if left unset or simply as an empty string, the PasswordStrengthRegularExpression would cause a Null Exception in the MySQLMembershipProvider. I solved that by modifying the providers code to fix the “if” statement where the problem was occurring. (If I recall, it was only checking that the string wasn’t empty, it didn’t check for the string being null)
The second was that the MySQLMembershipProvider has an Initialize method, overridden from the base class, which must be called on each instantiation of the provider. This method was being called only on the very first instantiation but not again afterwards (determined by stepping through the code and use of breakpoints). The provider appears to be instantiated once per page load.
My solution (not the best) has been to modify the MySQLMembershipProvider to create static variables to store the arguments of the call to Initialize and a variable to store whether or not the object has been initialized. I then put a call to the Initialize method at the beginning of every other method. The Initialize method was modified to return instantly if the object had already been initialized.
My query is this: Is the MySQLMembershipProvider flawed and thus the issues I’m describing are bugs or have I misunderstood something and not correctly used the MySQLMembershipProvider?
N.B. If you want to see code, please tell me which bits as 90% of it is auto generated or available from the mysql dev site as source. There is quite a lot.
I'd like to programmatically retrieve information related to test results. After a test run, I want to go through the test results and, for each test failed, to get the name of the failed test, the reason why it failed (validation rule message or extraction rule message) and the value of one key contained in the test context.
I couldn't find anything that I can use on how to dig into trx and webtestResult files. Does anyone have any hints for me?
Thanks,
Paul
After searching a bit more I came upon this:
https://blogs.msdn.microsoft.com/slumley/2009/11/11/vsts-2010-feature-api-for-processing-web-test-results/
The RequestResult property returns a WebTestRequestResult object, which exposes 2 properties, ValidationRuleResults and ExtractionRuleResults, through which the needed information can be retrieved.
With asp.net mvc you can use the annotation
[Required (errormessage="This is required")]
How can I create something like this:
[Required (errormessage="ERRORXX")]
So I can look up in a database what this ERRORXX is and display it on my form. Now my form displays ERRORXX.
How can I create something that solves my problem?
Thx!
Just an idea: why not pull the error messages from a resx file? I think this is the common way of doing this. It even allows you to localize your error messages easily.
I think that by using a resource file (resx file) it's even easier to change the error messages later on. A resx file can be opened and edited in Word Pad for example. You don't need to access a database with username/password, query it, etc.
Localizing ASP.NET MVC Validation
Globalizing ASP.NET MVC Client Validation
Take a look here too:
Model Validation & Metadata in ASP.NET MVC 2
Customizing ASP.NET MVC 2 - Metadata and Validation
The default route to take is with Resources.
However, I understand your pain :) The way I've achieved it is a little unusual, but I'll give you a quick rundown.
In our project, using resource files is not an option as its way too limited for our purposes, the details of which I won't bore you with now! :)
At it's most basic principle, we're setting the errorMessage property of the validation attribute to some sort of "key", and then just using that as a way to lookup the correct (languaged) response in our CMS database, when the validation fails (in our case using MVC, when we update the model and check the state - all at Controller level).
This is the same principle as using the resources (by specifying "ErrorMessageResourceName" and "ErrorMessageResourceType"), but you get to do what you want with it.
To be clear, we originally extended the RequiredAttribute (as one example) with our own stuff, including putting in properly named arguments to allow us to retrieve a sensible CMS value from the database later on. To be extra clear, we're using MVC and custom HtmlHelpers to render our own ValidationControls, which are what ultimately consume the custom values from our custom annotations, etc - None of this affects the dumbed-down principle here though, which is to just use "errorMessage" , or something like it, as a way to look up the actual message from where YOU want to, and WHEN you want to.
I think you mean you want to read/use attribute declarations for a given property?
If so, you could either make your own RequiredAttribute class (to allow adding new or more appropriate properties as you wish). See: Attributes Tutorial