I use plugins to set names of such entities. To simplify development of such plugins I did a base class and want to share it with you.
Let me show you example of the plugin which is based on SetNamePluginBase (base plugin) I share below.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | using ExitoConsulting.Plugins.Base; using Microsoft.Xrm.Sdk; namespace ExitoConsulting.Plugins { public class OwnerSetName : SetNamePluginBase { protected override string GetName(Entity entity, IPluginExecutionContext context, IOrganizationService service) { var fullName = entity.GetAttributeValue< string >( "ec_fullname" ); var clientId = entity.GetAttributeValue< string >( "ec_clientid" ); if ( string .IsNullOrEmpty(fullName)) { return null ; } var name = fullName; if (! string .IsNullOrEmpty(clientId)) { name = name + string .Format( " - {0}" , clientId); } return name; } } }</ string ></ string > |