Code based destination rule

  • 28 October 2005
  • 1 reply
  • 1 view

Badge +1
I want to use code to decide on my destinations, so I've taken a simple destination rule that says I'm the destination of an activity, clicked generate code, switched to use code, and now I get an error that the email is not found. I haven't modified the generated code at all. When I was using the GUI instead of the generated code it worked fine. Here is the generated code:
public void Main(ref DestinationRuleContext K2) {


SourceCode.K2Utilities.DSHelper oDSH = new SourceCode.K2Utilities.DSHelper(SourceCode.K2Utilities.DSHelper.DSHelperNewOptionsEnum.DefaultLDAPDomain);
System.DirectoryServices.DirectoryEntry oDEManager;
string sManager;
bool bAllTrue = true;
CDest1 oDest1 = new CDest1();
oDest1.Main(ref K2);
if (oDest1.IsSuccess == true) {
//== sendto
K2.Destinations.Add(DestinationType.User, @"RUSHENTFransellaJ");

if (bAllTrue == false) return;
}
}

// Destination Classes

private class CDest1 {
public bool IsSuccess = false;

public void Main(ref DestinationRuleContext K2) {
this.IsSuccess = true;
}

}

1 reply

Badge +11
This is a strange error since the Destination Rule should NOT interact with Active Directory or whatever user manager you're using to obtain the users email address.

Have you been able to solve this problem - it's probably not in the Destination rule itself but somewhere else in the process.

Regards,
Ockert

Reply