+ Start a Discussion
SalesforceAddictSalesforceAddict 

please help to soalve this assignment

Assignment 1. Create Batch Class to Process Stagings and insert Opportunity
 Objectstaging__c
Fields:
  1. Individual_or_Organization__c (Text)
  2. Organization_Name__c
  3. First_Name__c
  4. Last_Name__c
  5. Postal_Code__c
  6. Date_Recieved__c (Date)
  7. Amount__c (Currency)
  8. Error_Message__c (Long Text)
  9. Description__c
 
Requirement:
 
Case1.  If  Individual_or_Organization__c==I  ,
  • Search for existing contact with matching FistName , LastName and Postal Code. If contact not found then create new contact.
 
  • If staging record contains value in Organization_Name__c  and Postal_Code__c Fields then search for account with matching name and postal code. If account found then link contact record with this account.
 
  • Create new opportunity record for that contact.
 
Case2. If  Individual_or_Organization__c==O 
  • Search for existing Account  with matching  Organization_Name__c and Postal Code. If Account not found then create new account.
 
  • If staging record contains value in Last_Name__c and Postal_Code__c  Fields then search for contact with matching firstname,lastname  and postal code. If contact found then link contact record with the  account.
 
  • Create Opportunity record for account
 
Field Mapping for Opportunity:
OpportunityName = Account Name or Contact Name+CloseDate
ColseDate = Date_Recieved__c
Amount = Amount__C
Description=Description__c
 
Niraj Kr SinghNiraj Kr Singh
Hi Sachin,

I have replied the same in your one of question (reuse and update according to your case 2, it will work.):
https://developer.salesforce.com/forums?id=9060G0000005heyQAA

 
SalesforceAddictSalesforceAddict
ok bro thnx