Tuesday, July 24, 2012 1:02 PM
I'm hope to create a time-limited trial version of a solution. I figured that probably the best way to do this would be using a plugin on relevant entities that compares the date to the install date of the solution and blocks certain fields/functions.
In my initial search I couldn't find anything on how to access this (using c# in a plugin) programmatically. Or if there is a better way of tackling this.
Tuesday, July 24, 2012 2:03 PM
Which bit are you having trouble with sorry? Retrieving the solution record from the plugin, accessing the installedon date or something else I'm missing?
Tuesday, July 24, 2012 2:14 PM
Apologies for not be more clear.
In c#, I don't know how to access the solution record (i.e. the logical name of it) Then when I have that, I assume from your reply that the schema name of the field is installedon which I can then run a conditional on.
Tuesday, July 24, 2012 2:42 PM
Solutions are stored as entities in CRM (as most things are) so you can retrieve your solution record by using the entity logical name 'solution'. If you look at the sdk and search for 'solution entity metadata' this will show you all the attributes the solution entity has.
To retrieve the solution from the plugin, you will need to use one of the querying methods: QueryExpression, QueryByAttribute, FetchXml or LINQ. An example using QueryExpression (assuming you have an IOrganizationService object called 'service'):
string uniqueSolutionName="mySolutionName"; ConditionExpression condition=new ConditionExpression("uniquename", ConditionOperator.Equal, uniqueSolutionName); FilterExpression filter=new FilterExpression(); filter.AddCondition(condition); QueryExpression query=new QueryExpression("solution"); query.ColumnSet=new ColumnSet("friendlyname", "installedon","version"); query.Criteria=filter; EntityCollection results=service.RetrieveMultiple(query); Entity retrievedSolution=results.Entities;
Hope that helps. Please ask more question if its not clear/hasn't answered your question :-)
- Marked As Answer by Chris0123456 Tuesday, July 24, 2012 2:50 PM
Tuesday, July 24, 2012 2:52 PM
Perfect! Many thanks. That gives me a great place to start.