2016-11-10 71 views

回答

2

您需要註冊插件才能將消息,主要和次要實體關聯爲無。

在插件,您需要檢查context.MessageName(「副」或「取消關聯」)和context.InputParameters [「關係」(我們正在尋找「systemuserroles_association」)

代碼來檢查條件會是這樣的

//all usual plugin stuff here 

if (context.InputParameters.Contains("Relationship")) { 
    relationshipName = context.InputParameters["Relationship"].ToString(); 
}         

// Check the 「Relationship Name」 with your intended one 
if (relationshipName != "systemuserroles_association") { 
    return; 
} 

if (context.MessageName == "Associate") { 
    //logic when role added 
} 
if (context.MessageName == "Disassociate") { 
    //logic when role removed 
} 
else { 
    //not interested 
} 

我還沒有編譯的代碼,但它應該讓你知道如何進行。

相關問題