This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Create Report Subscription script

Hello, 

I need to create the report subscriptions from script/process. 

I have a number of reports that are bundled as a standard package. All of them should be assigned to users automatically.
User can opt out from those subscriptions at any time. 

Is there any way to do this from script/process?

I've tried inserting records using object browser manually, the insert action is prevented (permission missing). 

If there is no out-of-the-box method, what records (in which tables) I should insert to create subscription manually?

 

Thanks, 
Piotr Markiewicz

  • Hi Piotr,

    What version are you using?

    Are the entries for the reports already present in the RPSReport table?

    What table is preventing an insert?

    PersonHasRPSReport is the table that stores subscriptions for Person records. Provide there is an actual report, UID_RPSReport, and a person to assign to, UID_Person, you should be able to insert a row here.

    But if there is a permissions issue, that should be addressed first. Any script you use would fail for the same reason if permissions are insufficient.

    Trevor
  • Hi Trevor,

    I'm using version 7.1.1.

    I have the reports configured in RPSReport, user is assigned to the report directly (record in PersonHasRPSReport).

    I've tried inserting new row using Object browser, and this is the error I got:

    Report subscriptions: Write permission denied for values: ExportFormat,Ident_RPSSubscription,UID_DialogSchedule,UID_Person,UID_RPSReport.

     

    I've checked the permission on the column, and this is what I can see (on all 3 ref columns):

    I'm guessing that IT Shop is either using SQL or there is a method somewhere that creates the subscription. 

     

    Piotr

  • Hi Piotr,

    Yes, there is an insert that takes place in IT Shop and you can see this in the SQL log for the web portal, if it's enabled, e.g.:

    insert into DialogProcess (GenProcID, BasisObjectType, ObjectKey, ProcessState, DisplayName, XDateInserted, XDateUpdated, XUserInserted, XUserUpdated)

     select '7b8eb2b9-428e-4e8d-b30f-16669a47037d', 'RPSSubscription', '<Key><T>RPSSubscription</T><P>f7a2e9a2-97b4-4f9c-9551-1b7506306142</P></Key>', 'G', N'Insert - Account Access', GetUTCDate(), GetUTCDate(), N'TREVORP', N'TREVORP'  

      where not exists (select 1 from dialogprocess where GenProcID = '7b8eb2b9-428e-4e8d-b30f-16669a47037d')

    But there are very specific permissions on this table, and you'll get a better overview of this in Designer:

     

    So you would need to assign a permissions group that would allow for an insert.  But I suggest to be very careful with this.

    Trevor

  • What about the simple idea, of creating 1 Subscription through manager or webportal and then adding all the subscribers in RPSSubscriptionCC.
  • Hi, it would work, although I don't like the long CC list in emails. Plus it would mean adding almost all employees to the CC...
  • Just as a clarification.

    The table PersonHasRPSReport does not store the report subscription itself. It stores the access of a person to a subscribable report. So if a person has an entry for such a subscribable report here, the person is allowed to create a subscription to this report in the web portal.

    So, if everybody should be able to create his own subscriptions you just have to assign the subscribable reports to either an application role or business role that everybody is a member of.

    The subscriptions itself are stored in the tables RPSSubscription and RPSSubscriptionCC. But you have to keep in mind that a subscription consists of the subscribable report and of the defined, calculated or selected parameters for the report. These are stored in different tables as well.

    If everybody should be able to get a report with the same parameter set, the best practice would be to create a subscribable report (RPSReport) that defines all parameters as desired and having the parameter type set to fix or calculated.

    HtH

  • Hi Markus,

    thank you for your reply. The reports will have only fixed and calculated parameters.

    I've managed to create successful subscription, by:
    * Creating manually in SQL entry in RPSSubscription (bypassing Object Layer permission check)
    * Calling method "Create default parameter set" on newly created report subscription (in Object browser)

    This way I was able to receive the report and manage it in the UI (change parameters/unsubscribe) without any errors.


    Thank you guys for all the help.