我目前正在使用InvalidPluginExecutionException该消息发送给用户,但事实证明该消息是英文的,"Business Process Error"超出该消息的错误框出现在按钮上"download log file".这不是错误,因为用户正在尝试复制记录,如代码中所示.还有其他方法,而不必使用InvalidPluginExecutionException显示警报?
QueryExpression query1 = new QueryExpression();
query1.ColumnSet = new ColumnSet(true);
query1.EntityName = "new_appraisers";
EntityCollection ec = service.RetrieveMultiple(query1);
if (ec.Entities.Count <= 0)
{
log.Tb_Log_Create("Appraiser created");
}
else
{
foreach (Entity app in ec.Entities)
{
if (app["fcg_appraiser"].ToString() == name)
{
log.Tb_Log_Create("appraiser allready exist");
throw new InvalidPluginExecutionException("The name allready exists");
}
if (app["new_login"].ToString() == login)
{
log.Tb_Log_Create("appraiser allready exist");
throw new InvalidPluginExecutionException("The login allready exists.");
}
}
}
Run Code Online (Sandbox Code Playgroud)