2
votes

I need certain custom entity fields to calculate and display values based on operations on the data in the system.

For example an a booking system implementation with contacts and custom entity: tickets. There is a one-many relationship between contact and tickets.I would like to create a field that calculates and displays in the contact form:

  1. frequent flyers: more than 10 tickets bought.
  2. a field that displays yes or no based on whether a first class ticket has ever been purchased. Ticket ref would start with say, FCxxx

If this isn't possible perhaps someone could suggest an alt method for displaying this info?

2
Were the replies provided sufficient or do you need help with the actual implementation of the code?Konrad Viltersten
Thanks for your comments guys. To clarify i need this information to be accessible to an Advanced Find so i can display the results in a resultant view or use the results to build a marketing list etc. Does this rule out client side scripting? I would imagine it does and instead requires stored values. What do you think?mechalaris
I don't know of a way to compute temporary values for display (something that's been bugging me for quite some time). It'd be interested if somebody could suggest a way to resolve it but until I stand corrected, the answer is no. Is computing and storying the values a technical problem in your project?Konrad Viltersten

2 Answers

0
votes

As far I'm aware, it's not possible to achieve without coding. So, if you're looking for a way to customize it by mousing, you might be just out of luck.

If you wish to display that information upon retrieval of the a customer, it's probably fastest to get it using JavaScript. You can add a custom script to onload event. However, that means that you'll have to write JavaScript so if you're not into coding you'll have problems.

If you do know how to code, perhaps creating a plugin with C# is the most preferred way (that's what I'd do at least). The advantage of that lies in extensibility, should you realize that you wish to perform more operations.

Also, if you wish to store the computed values, you'll have to go with a plugin. Otherwise, only GUI operations will perform the computations. If a program will enter/retrieve data in the background, you can't rely that the values will be computed, unless you listen to the messages of Retrieve, Create etc.

2
votes

This is possible and you have some ways to do that: Workflow or Plug-in.

If you make a lot of calculations i think the best way is doing a plug-in. You can register in post create event of tickets entity and there you can make all this calculations and update the custom fields of contact entity.

You can check some tutorials about developing a plug-in:

  1. http://mscrmshop.blogspot.pt/2010/10/crm-2011-plugin-tutorial.html
  2. http://msdn.microsoft.com/en-us/library/gg695782.aspx
  3. http://crmconsultancy.wordpress.com/2010/10/25/plugins-in-crm-2011/

Specific information about registering a plug-in:

In SDK you can find more examples.