示例#1
0
 protected void DerivedConcatenatedField(string fieldToSet, string[] fields, string separator)
 {
     if (IsMessage(PluginMessage.Create, PluginMessage.Update) &&
         Stage == PluginStage.PreOperationEvent)
     {
         if (FieldChanging(fields))
         {
             var values = new List <object>();
             foreach (var field in fields)
             {
                 var value = XrmEntity.GetFieldAsDisplayString(GetField(field));
                 if (!String.IsNullOrWhiteSpace(value))
                 {
                     values.Add(value);
                 }
             }
             SetField(fieldToSet, String.Join(separator, values));
         }
     }
 }