Subscribe and unsubscribe automatically

With CPR Batch, it is possible to automatically subscribe to a person when the person is related to one or more open cases, and is not already subscribed to at CPR.

If it is no longer allowed to subscribe to a person, CPR Batch will automatically unsubscribe from this person. For example, if a person is not related to any open cases and was subscribed more than 7 days ago, it is not allowed to subscribe to this person at CPR.


Subscription settings in the Source_record Table

CPR Batch handles subscribing to or unsubscribing from persons that are marked to be subscribe or unsubscribed in the SOURCE_RECORD table.

When you subscribe to a person, the data for this person is retrieved from CPR.

In the SOURCE_RECORD table, two fields are used for subscription settings:

  • SRC_SUBSCRIBED:
  • ‘J’ means that the persons is subscribed to CPR. ‘N’ means that the person is unsubscribed from CPR. The field is maintained by the ImportManager that sets it to ‘J’ when retrieving data from CPR, and to ‘N’ when sending unsubscribing data to CPR.

  • SUBSCRIBED:
  • ’J’ subscribes a person if the person is not already subscribed to CPR. ‘N’ means unsubscribes a person if the person is subscribed to CPR.

When you upgrade the database to WorkZone Content Server 2021.1, all records for the source ‘CPR’ are updated to set the SRC_SUBSCRIBED field to ‘J’ and the SUBSCRIBEDfield to null. This is based on the assumption that all persons for source = ‘CPR’ are subscribed to CPR.

At a customer site, it may be necessary to adjust the setting for the SRC_SUBSCRIBED field, if the assumption that all persons are subscribed is not correct.

A customer can get a file from CPR that includes all CPR numbers that the customer has subscribed to. The data in this file can be used to set the SRC_SUBSCRIBED field.


The SJP_CPR_ADM .SET_SUBSCRIPTION job

You use the SJP_CPR_ADM .SET_SUBSCRIPTION job to set the SUBSCRIBED field automatically.

Subscribe

The SUBSCRIBED field is set to ‘J’ if the person:

  • Is not subscribed to CPR (SRC_SUBSCRIBED=’N’).
  • Is related to one or more open cases.

If a customer wants another algorithm for automatically subscribing to or unsubscribing from a person, you can create another job that sets the SUBSCRIBED field. You can use the standard WorkZone Content Server Oracle package SJP_CPR_ADM as a template for the job.

Unsubscribe

The SUBSCRIBED field is set to ‘N’ if the person:

  • Is subscribed to CPR (SRC_SUBSCRIBED=’J’).
  • Is not related to any open cases.
  • And it is more than 7 days ago that the data of that person was updated from CPR.
  • Note: When you start the job, you can specify a different number of days than 7. 7 days is the default value.

Start the SJP_CPR_ADM .SET_SUBSCRIPTION job

Execute the following statement to start the job:

sjp_cpr_adm.job_set_subscription(<start_time>, <delay_days>)

  • <start_time> is ‘trunc(sysdate+2)’ by default. The job runs every night 2 hours after midnight.
  • <delay_days> is 7 by default. It specifies how many days ago the person's data was updated from CPR, see above.