Share:

PREVIOUS  |  NEXT

True Producer Integration

Quick Links


Notice: We are currently working to improve this content. Once revisions are finalized, we will add the article to the Recently Updated Articles section on the product's Documentation Home page. Learn more.


This article provides code samples you can use to create a producer in the True Producer application from Workflow.

Validation

Validate Contact Data

[Back to top]

if (currentCase.contact == null) resp.fail('Contact is not created')
if (currentCase.contact.lastName == null ) resp.fail('Missed custom field currentCase.contact.lastName')
if (currentCase.contact.firstName == null ) resp.fail('Missed custom currentCase.contact.firstName')
if (currentCase.contact.email == null ) resp.fail('Missed custom field currentCase.contact.email')


Validate Producer and Company Data

[Back to top]

if (currentCase.getCustomField("parent_entity_name") == null ) resp.fail('Missed custom field parent_entity_name')
if (currentCase.getCustomField("parent_tax_id") == null ) resp.fail('Missed custom field parent_tax_id')
if (currentCase.getCustomField("nipr_id") == null ) resp.fail('Missed custom field nipr_id')
if (currentCase.getCustomField("producer_type") == null ) resp.fail('Missed custom field producer_type')

Random random = new Random()


Log In to True Producer

[Back to top]

def cm = resp.loadInstance('cm.Manager'); cm.init('PortalAdmin','Portal123');


Create New Producer

[Back to top]

def p = cm.newProducer(); p.effectiveStartDate = cm.createDate(2012, 1, 1); // setting up date

p.payeeId = 'PROD' + random.nextInt(10 ** 5); // creating producer ID


Define All Producer Types

[Back to top]

def t1 = cm.newProducerType(); t1.name= 'Agent';
def t2 = cm.newProducerType(); t2.name= 'Employee';
def t3 = cm.newProducerType(); t3.name= 'Office';


Choose Producer Type According to Existing Data on Onboarding Form

[Back to top]

if ( 'Sole Proprietorship' == currentCase.getCustomField("producer_type").value ) { 
p.producerType = t1;
}
 else if ('Individual' == currentCase.getCustomField("producer_type").value) {
 p.producerType = t2;
} 
else {
p.producerType = t3;
} 

cm.setValue(p, 'taxId', currentCase.getCustomField("parent_tax_id").value); // setting insurance company tax id

// setting producer status
def s = cm.newStatusCode(); s.status = 'Active'; s.name = 'Employed'; p.statusCode = s;


Set Producer's Basic Information

[Back to top]

p.lastName = currentCase.contact.lastName;
if (currentCase.getCustomField("middle_name_2") != null)  p.setMiddleName(cm.createValueClass(currentCase.getCustomField("middle_name_2").value, "com.callidus.org.participant.Participant", "middleName"));
p.setFirstName(cm.createValueClass(currentCase.contact.firstName, "com.callidus.org.participant.Participant", "firstName"));
p.setEmail(cm.createValueClass(currentCase.contact.email, "com.callidus.producer.domain.base.Producer", "email"));

cm.setValue(p, 'companyName', currentCase.getCustomField("parent_entity_name").value);
cm.setValue(p, 'naicId', currentCase.getCustomField("nipr_id").value); 
cm.setValue(p, 'birthday', cm.createDate(2000, 1, 1));

def result = cm.validate(p); // validating producer

if (result == null) {
   cm.create(p); 
} 
else {
 resp.fail(result); 
}

Addresses

Copy Contact Data from Workflow to True Producer

This code example illustrates how to copy data from the Contact Information tab in Workflow to the Dealer Address tab in True Producer:

[Back to top]

def pa1 = cm.newProducerAddress();
cm.setValue(pa1, 'address1', currentCase.getCustomField('address').value); 
cm.setValue(pa1, 'address2', currentCase.getCustomField('address_line_2').value); 
cm.setValue(pa1, 'city', currentCase.getCustomField('city').value);
cm.setValue(pa1, 'postalCode', currentCase.getCustomField('zip_code').value); 
cm.setValue(pa1, 'mobile', currentCase.getCustomField('mobile_number').value);
cm.setValue(pa1, 'phone', currentCase.getCustomField('phone_number').value);

if (currentCase.getCustomField('state').value == 'Alaska')cm.setValue(pa1, 'state', "AK");

pa1.setEffectiveStartDate(cm.createDate(2012, 1, 1));
def pat = cm.newProducerAddressType(); pat.setName("Residence"); pa1.setProducer(p); pa1.setProducerAddressType(pat);
def pa0 = cm.newProducerAddress();
cm.setValue(pa0, 'address1', currentCase.getCustomField('address_2').value);
cm.setValue(pa0, 'address2', currentCase.getCustomField('address_line_22').value);
cm.setValue(pa0, 'city', currentCase.getCustomField('city_2').value);
cm.setValue(pa0, 'postalCode', currentCase.getCustomField('zip_code_2').value);
cm.setValue(pa0, 'phone', currentCase.getCustomField('phone_number_2').value);
cm.setValue(pa0, 'fax', currentCase.getCustomField('fax_number').value);

if (currentCase.getCustomField('state_2').value == 'Alaska') cm.setValue(pa0, 'state', "AK"); pa0.setEffectiveStartDate(cm.createDate(2012, 1, 1));
def pat1 = cm.newProducerAddressType(); 
pat1.setName("Business");
pa0.setProducer(p); 
pa0.setProducerAddressType(pat1);
cm.create(pa1); cm.create(pa0);


License

Set Producer License

[Back to top]

def pl = cm.newLicense();
pl.setEffectiveStartDate(cm.createDate(2012, 1, 1));
pl.setLicenseNumber("100");
pl.setProducer(p);
pl.setStartDate(cm.createDate(2012, 1, 1));
pl.setExpirationDate(cm.createDate(2099, 1, 1));

def lt = cm.newLicenseType(); 
lt.setName("Producer"); 
pl.setLicenseType(lt);

def jt0 = cm.newJurisdiction();
jt0.setName("CA"); 
pl.setJurisdiction(jt0);

def s1 = cm.newStatusCode(); 
s1.setStatus("Active");
s1.setName("Valid");
pl.setStatusCode(s1);
cm.create(pl);


Appointment

Set Producer Appointments

[Back to top]

def papp = cm.newAppointment(); 
papp.setProducer(p);
def at = cm.newAppointmentType(); 
at.setName("Agent"); 
papp.setAppointmentType(at);

def s2 = cm.newStatusCode(); 
s2.setStatus("Active"); 
s2.setName("Valid"); 
papp.setStatusCode(s2);

def jt1 = cm.newJurisdiction(); 
jt1.setName("CA"); 
papp.setJurisdiction(jt1);
papp.setEffectiveStartDate(cm.createDate(2012, 1, 1));
papp.setStartDate(cm.createDate(2012, 1, 1));
cm.setValue(papp, "effectiveEndDate", cm.createDate(2099, 1, 1));
papp.setExpirationDate(cm.createDate(2099, 1, 1));
papp.setAppointmentNumber("CA99999");
cm.create(papp);

Continuous Education

Set Producer Courses

[Back to top]

def ce = cm.newContinuingEducation();
ce.setEffectiveStartDate(cm.createDate(2012, 1, 1)); 
ce.setProducer(p);
ce.setExpirationDate(cm.createDate(2099, 1, 1)); 
ce.setName("CE Name"); 
cm.setValue(ce, "completionDate", cm.createDate(2012, 1, 1));

def la = cm.newLineOfAuthority(); 
def jt2 = cm.newJurisdiction(); 
jt2.setName("CA"); 
la.setJurisdiction(jt2); 
la.setName("Basic"); 
cm.setValue(ce, "lineOfAuthority", la);

def s3 = cm.newStatusCode(); 
s3.setStatus("Terminated"); 
s3.setName("Completed");
ce.setStatusCode(s3); 
cm.create(ce);



Related Article