Modifying the Composite ID in Primero v2

In order to customize the ID in CPIMS+ you must follow these steps:

1.The field value which is to be included in ID should be present in case and should be compulsory.
2.Then in System settings file you have to include the fields in auto populate list.
3.For e.g if your composite id needs age and agency code of caseworker you can write it as
auto_populate_list: [

 {"field_key":"case_id_code","format":["age","created_by_user.agency.agency_code"],"separator":"-","auto_populated":true}
  ],

4.Also, you can perform ruby actions on this fields e.g(customize date format)

1 Like

As an example:

auto_populate_list: [
	    {
	      field_key: 'name',
	      format: %w[
	        name_first
	        name_middle
	        name_last
	      ],
	      separator: ' ',
	      auto_populated: true
	    },
	    {
	      field_key: "case_id_code",
	      format: [
	        "created_by_user.user_location.ancestor_by_type(district).location_code",
	        "created_at.strftime(%m/%y)"
	      ],
	      separator: "/",
	      auto_populated: true
	    }
	  ],
1 Like