CWM - questions on creating a space automatically

mah1
Kilo Sage

Yokohama

 

Would like to know if the following is possible...

 

When a new IT person is added, we want to automatically create a new space named 'Welcome to IT!' in CWM for that person then apply several templates to that space. These templates would add various documents and tasks to the Welcome to IT! space for the new IT person which will familiarize them with standard operating procedures and requirements.

 

Is it possible to do this using a script or flow?  What tables are involved? Where are spaces stored for a user? I looked at the sn_cwm_space table but that doesn't seem to list spaces created by users.

 

Thank you!

1 ACCEPTED SOLUTION

Sunil B N
ServiceNow Employee
ServiceNow Employee

Hi Michele,


This is great use case for whole Space to be saved as template. This is in our future roadmap.

Nevertheless, Currently this is feasible with Flows and scripting.
Steps:
1. Creation of Board template for tasks

2. Creation of Doc template with multiple pages for on boarding of the user.

3. Creation of Space. This step also automatically creates permission(sn_cwm_persmission) for the user to access that table

4. Creation of new Board using the Board template from step 1

5. Creation of new Doc using the Doc template from step 2.

Technical details:
a. Use new space as CWM user and create required Board and Doc template. Keep track of sys_ids. You can take a look in the table `
sn_cwm_template`
b. Create a new flow to trigger when new `sys_user` under `IT` Department is created then create a new Space.
table: sn_cwm_space.
c. Using `
sn_cwm.CWMTemplateService` script API, use `createFromTemplate: function(templateId, type, sourceId, sourceType, additionalParams)`  

templateId : sysId of template from Step a.
type: "doc"/"board"
sourceId:  space sys id from previous Step b.
sourceType: "space"
additionalParams: json as below
{
sourceTable: 'sn_cwm_template',
label: 'Doc or Board name',
triggerPoint: 'cwm_create_button', //required for doc 
docId: '-1', //required for doc 
}

This will create records mainly sn_cwm_board, sn_cwm_menu_item, sn_cwm_doc, sn_cwm_doc_page, sn_cwm_doc_m2m.


Alternatively you can include in the personal space we create: take a look at 

sn_cwm.CWMNavigationAPI._getOrBuildPersonalSpaceGr().


Disclaimer: The APIs used may be subjected to change in the future releases.

Hopefully this would help to get started.

Please let us know if you have any further questions.



 

View solution in original post

15 REPLIES 15

Thank you so much for all your help!