In order to run Import Security jobs in your instances, you will need a .csv file which contains the security details you want to import into your application. In my example, I will mention about giving access right on a particular dimension, however you can use same file format and mechanism to import not only dimension security but also other application objects. I have found following list of objects supported from documentation.
SL_FORM – Form
SL_COMPOSITE – Composite Form
SL_TASKLIST – Tasklist
SL_CALCRULE – Rule
SL_FORMFOLDER – Form Folder
SL_CALCFOLDER – Rule Folder
SL_DIMENSION – Dimension
SL_CALCTEMPLATE – Template
SL_REPORT – Management Report
SL_REPORTSSHOT – Management Report Snapshot

Here is the sample .csv file

If you upload your file to Inbox/Outbox Explorer, you can call rest api from groovy using a predefined connection object from your application.

def params = new JSONObject()
        .put("fileName","ImportSecurityRecordsFile.csv")
        .put("clearAll","false")
        .put("errorFile","SecurityImportErrors.txt")            
def body = new JSONObject()
        .put("jobType","Import Security")
        .put("jobName","ImportSecurity")
        .put("parameters",params)        
        .toString()
HttpResponse jsonResponse = operation.application.getConnection("jobs").post().body(body).asString();

As usual, you will need to check HttpResponse is returning Status OK and check the job is successfully completed. They are covered in previous blogs so many times, I won’t cover here again.

If there is any failure in import job, you should be able to see details in SecurityImportErrors.txt file. If everything goes well, you can see security definition is visible in the member definitions.

Thanks for reading,