How to use Assignment Rules with pyax ?
I am trying to use Assignment Rules for Leads with pyax and I am using the following code:
sfdc.
sfdc.
However pyax is complaining whenever a new Lead is being created.
Can you give me any code samples that show how to use Assignment Rules with pyax ?
I was given the following Java code to help guide my development effort: (It seems SalesForce loves Java...)
package com.sforce;
import java.net.
import java.net.URL;
import java.rmi.
import com.sforce.
import com.sforce.
import com.sforce.
import com.sforce.
import com.sforce.
import com.sforce.
import com.sforce.
import com.sforce.
import com.sforce.
import com.sforce.
import com.sforce.
public class LeadAssignment {
static LeadAssignment _leadAssignment;
public static void main(String[] args) {
_leadAssignment = new LeadAssignment();
try {
_leadAssignme
} catch (Exception e) {
e.printStackT
}
}
public void CreateLead() throws UnexpectedError
RemoteException {
//Create the proxy binding and login
SoapBindingStub binding = (SoapBindingStub) new SforceServiceLo
LoginResult lr = binding.
//Reset the binding to use the endpoint returned from login
binding.
loginResult
//Create the session id header, and add it to the proxy binding
_SessionHeader sh = new _SessionHeader();
sh.setSession
binding.
"SessionHeader", sh);
//Create a new case and assign various properties
Lead lead = new Lead();
lead.
lead.
lead.
lead.
//The lead assignment rule will assign any new leads that
//have "API" as the LeadSource to a particular user
//Create the assignment rule header and add it to the proxy binding
_AssignmentRu
//In this sample we will look for a particular rule and if found
//use the id for the lead assignment. If it is not found we will
//instruct the call to use the current default rule. You cannot use
//both of these values together.
QueryResult qr = binding.
'Mass Mail Campaign' and RuleType = 'leadAssignment'");
if (qr.getSize() == 0) {
arh.setUseDef
} else {
arh.setAssign
}
binding.
SforceService
arh);
// Every operation that results in a new or updated case, will
// use the specified rule until the header is removed from the
// proxy binding.
SaveResult[] sr = binding.create(new SObject[] {lead});
for (int i=0;i<sr.
if (sr[i].isSuccess())
System.
sr[
else
System.
sr[
}
// This call effectively removes the header, the next lead will
// be assigned to the default lead owner. Remember to add the
// session header back in.
binding.
binding.
SforceService
}
}
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- pyax Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Ray C Horn
- Solved:
- Last query:
- Last reply: