Hi i just dive to this crm thing, i'm still very new to this so my friend recomend me to use plugin instead of javascript because he said that plugin is running in backend and javascript code is running in frontend, so i tried some tutorials from ebook and i try to do this excersie , that have scenario like this
The training solution you imported to Dynamics earlier contains an entity called ita_trainingconfiguration You need to make sure that, for any create or update of that entity, ita_notestallowedmessage attribute has some data (other than null). Can you add a new plugin to our current solution,
here is my code below
using Microsoft.Xrm.Sdk; using System; namespace TrainingConfiguration.Plugins { public class ConfigurationValidation : IPlugin { public void Execute(IServiceProvider serviceProvider) { IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext)); Entity entity = (Entity)context.InputParameters["Targets"]; string note = (string)entity["ita_notestallowedmessage "]; if(note == null) { throw new InvalidPluginExecutionException("Field can't be empty"); } } } }
from what i catch from this tutorial is note is a field from the Entity which is a target depend what primary entity we choose in register new step, and then i make condition to check if this field is null or not if null it will throw the exception message. at first i tough it because i'm misspelled the name of the field but i'm already double check the field name and i'ts correct. Can someone give me some explanation here thanks
*This post is locked for comments