Skip to main content Join the Agentforce Virtual Hackathon to build innovative solutions and compete for a $50k Grand Prize. Sign up now. Terms apply.
Amit Kumar が「#Collaboration」で質問
If we create a record in Jan 2020, matter_number__c should be - 2020-01-001 if this is the first matter created in Jan 2020. The next matter number assigned to the second record would be 2020-01-002 and so on. if we create record in Feb 2020, then matter_number__c should be -  2020-01-001 and the next should be 2020-02-002 and so on...

 

what would be the solution for this
1 件の回答
  1. 2020年1月23日 6:36
    Hi Amit, 

     

    There is no standard mechanism that does this - you will have to build something yourself. The trick is going to be keeping a counter that resets monthly, so that each month will begin a brand new count.

     

    The logic would be as follows:

     

    A new record is created, which would trigger a flow or Apex trigger

     

    The flow/trigger would query the most recently created record of the same object

     

    If the date portion of its creation time is different than the created date of the new record (has a different month or year), set a custom number field to 1

     

    Otherwise, set it to the queried record's number field + 1

     

    Use a formula field to combine the year, month, and the counter field
0/9000