You need to sign in to do that
Don't have an account?
Problem with auto assignment rule header
I can't seem to get the auto assign rules to fire. I create a lead, and it keeps getting assigned to the API account that I am using
_AssignmentRuleHeader arh = new _AssignmentRuleHeader();
arh.setUseDefaultRule( new Boolean( true ) );
m_Binding.setHeader("SforceService", "AssignmentRuleHeader", arh);
createResult = create( createObjs );
//clear the soap headers to make sure that the next call does not use the auto assign header unintentionally
m_Binding.clearHeaders();
//reset the headers
_SessionHeader sh = new _SessionHeader();
sh.setSessionId( getSessionId() );
m_Binding.setHeader( "SforceService", "SessionHeader", sh );
m_Binding.setHeader( "SforceService", "useCaseSafeIDs", "0" );
Hi ScottB,
Due to an error in the sample code in the documentation, this will not work the way your are setting it.
Rather than add the header like this:
binding.setHeader("SforceService", "AssignmentRuleHeader", arh);
You should add it like this:
binding.setHeader(new SforceServiceLocator().getService().getNamespaceURI(), "AssignmentRuleHeader", arh);
The doc is due to be updated shortly.
OK.
Here is what worked for me (finally)
_AssignmentRuleHeader arh = new _AssignmentRuleHeader();
arh.setUseDefaultRule( new Boolean( true ) );
m_Binding.setHeader("SforceService", "AssignmentRuleHeader", arh);
m_Binding.setHeader(new SforceServiceLocator().getServiceName().getNamespaceURI(), "AssignmentRuleHeader", arh);
Thanks to DevAngel for getting me headed in the right direction. And curses upon those who wrote the bad documentation! Just kidding.
Hi Scott,
Yup, getServiceName().getNamespaceURI(). I was writing this from memory, sorry.