0
我們正在使用CRM 2013.我試圖創建一個在創建CRM帳戶時觸發的插件。然後,插件將觸發並將一個屬性「AccountNumber」發送到內部Web服務。然而,web服務現在似乎並沒有被調用。CRM 2013:通過插件將帳戶信息傳遞到Webservice
起初我以爲我不得不做一個PostImage,但後來決定不再使用它了。另外,起初我使用「EntityMoniker」作爲插件參數,但後來將其更正爲鍵入「Target」。
這裏是我的代碼:
有人請指導我在正確的方向嗎?
var targetEntity = context.GetParameterCollection<Entity>(context.InputParameters,
"Target");
if (targetEntity == null)
{throw new InvalidPluginExecutionException(OperationStatus.Failed,
"Target Entity cannot be null");}
// Make sure the new Account Id is available
if (!context.OutputParameters.Contains("id"))
{return;}
var accountID = new Guid(context.OutputParameters["id"].ToString());
//putting postImage here but not being used
var postImage = context.PostEntityImages["PostImage"];
if (postImage == null)
{throw new InvalidPluginExecutionException(OperationStatus.Failed,
"Post Image is required");}
var AccountNumber = context.OutputParameters["new_AccountNumber"].ToString();
var service = new ServiceClient("");
var newProp = new PropertySetup
{
_prop = new Property
{
_propertyNm = AccountNumber
}
};
service.CreateNewProperty(newProp);
service.Close();
感謝。我改變了它,但是我仍然沒有看到任何web服務調用。有沒有辦法來檢查一個插件是否被解僱?提前致謝。 – ichachan 2014-11-03 23:54:41
是的,有一種方法可以檢查插件是否被解僱。你可以簡單地拋出異常,或者你可以調試你的插件:http://inogic.com/blog/2012/06/how-to-debug-plugins-using-profiler/ – nunoalmeida 2014-11-04 10:15:08