+ Start a Discussion
Rst123Rst123 

Auto number : i have a requirement where i need to have a auto number generated for child record

==============
Parent
- opportunity
Child - Policy
============
i have a requirement where i need to have a auto number generated for child record(policy) , but child records for 1 parent(opportunity) should be like Pol - 1000 - v0
      Pol - 1000 - v1
2nd opportunity child record format :
Pol - 1001 - v0
Pol - 1001 - v2
3rd opportunity child record format :
Pol - 1002 - v0
Pol - 1002 - v1

i.e if parent record is same then child record will have same number with different version, increment in number will be based on (set of policy records) realted to parent records , so policy records having same parent will have same number.
SijuSiju
This can be accomplished by the following steps . Pls try out 
1. Create a Auto number Field in Opportunity
2. Create a roll-up summary field in the opportunity to find the count of policies. 
3. Create  a text field in policy Object
4. Write a workflow rule  (select created - for Evaluate the rule when a record is:)
5. Create a field update to this new text field using the formula option 
Opportunity.OpportunityAutonumberField & ' -V' & Text( Opportunity.sampleRollUpSummaryfield +1)


This can be done using Trigger also with validation. 
Rst123Rst123
But having autonumber will create new number for each child record created??

my requirement is :
==================
Parent : opportunity 1
Child records :  
Pol - 1000 - v0
 Pol - 1000 - v1     (if you observe the numbring 1000 is common for both child under opportunity 1)
===================
Parent : opportunity 2
Child records :  
Pol - 1001 - v0
 Pol - 1001 - v1     (if you observe the numbring 1001 is common for both child under opportunity 2)
==================
Parent : opportunity 3
Child records :  
Pol - 1002 - v0
 Pol - 1002 - v1     (if you observe the numbring 1002 is common for both child under opportunity 3)
SijuSiju
Autonumber I mentioned is for the opportunity not for the child record. 
Rst123Rst123
Thanks for the reply

i dont want to have autonumber on opportunities as opportunities record may not have child record but will have auto number generated in this case 
SijuSiju
In that case, update the Opportunity number field using a Trigger based on the condition,  If child record is there then write the logic for an update that opportunity field. Without storing Opportunity number we can't do this.