ConcourseSuite Support

Support
Corporate
PUBLIC PROFILE

Add an Opportunity and an associated Opportunity Component

Using Centric Tools

// Establish connectivity information
CRMConnection crm = new CRMConnection();
crm.setUrl("http://www.example.com/crm");
crm.setId("www.example.com");
crm.setCode("password");
crm.setClientId(clientId);

//Add Meta Info with fields required
ArrayList meta = new ArrayList();
meta.add("description");
crm.setTransactionMeta(meta);

DataRecord opportunity = new DataRecord();
opportunity.setName("opportunity");
opportunity.setAction(DataRecord.INSERT);
opportunity.setShareKey(true);
opportunity.addField("description", "Opportunity Header");
opportunity.addField("manager", 1); //refers to user with id 1 in CCRM
opportunity.addField("accountLink", 1); //refers to account with id 1 in CCRM
opportunity.addField("accessType", 9); //indicates it is a Public opportunity record
opportunity.addField("enteredBy", 1);
opportunity.addField("modifiedBy", 1);
crm.save(opportunity);

DataRecord oppComponent = new DataRecord();
oppComponent.setName("opportunity");
oppComponent.setAction(DataRecord.INSERT);
oppComponent.addField("description", "Opportunity Component");
oppComponent.addField("owner", 1); //refers to user with id 1 in CCRM
oppComponent.addField("guess", 800000); 
oppComponent.addField("type", "N"); //indicates it is a new opportunity component; corresponds to 'Source' on the add form
oppComponent.addField("stage", 1); //corresponds to 'Prospecting' lookup entry in lookup_stage
oppComponent.addField("closeProb", 50);
oppComponent.addField("closeDate", "09/14/2007");
oppComponent.addField("closeDateTimeZone", "GMT-5 Easter US");
oppComponent.addField("terms", "15"); //indicates the time period
oppComponent.addField("units", "W"); //indicates the time period units; W for Weeks; M for Months
oppComponent.addField("enteredBy", 1); //refers to user with id 1 in CCRM
oppComponent.addField("modifiedBy", 1); //refers to user with id 1 in CCRM
crm.save(oppComponent);

boolean result = crm.commit();

XML

<app>
  <authentication>
    <id>127.0.0.1</id>
    <systemId>4</systemId>
    <clientId>1</clientId>
    < code>792fef441691aa41135a15c1478a5ee4< /code>
  </authentication>
  <transaction>
    <meta>
      <property>description</property>
    </meta>
    <opportunity action="insert" shareKey="true">
      <description>Opportunity Header</description>
      <manager>1</manager>
      <accountLink>1</accountLink>
      <accessType>9</accessType>
      <enteredBy>0</enteredBy>
      <modifiedBy>0</modifiedBy>
    </opportunity>
    <opportunityComponent action="insert">
      <headerId>$C{opportunity.id}</headerId>
      <owner>1</owner>
      <description>Component Description</description>
      <guess>80</guess>
      <type>N</type>
      <stage>1</stage>
      <closeProb>50</closeProb>
      <closeDate>09/14/2007</closeDate>
      <closeDateTimeZone>"GMT-5 Eastern US"</closeDateTimeZone>
      <terms>15</terms>
      <units>W</units>
      <enteredBy>0</enteredBy>
      <modifiedBy>0</modifiedBy>
    </opportunityComponent>
  </transaction>    
</app>

Sign in to add your comment.