Hi Experts,
There is a requirement from one of the client in Hybrid (on-prem) where any new user will be onboarded,the Admin will run a "Database Script" to create folder structure. Fo example, input parameter of the "DB script" can be a name of a Bank or any Organization_Name. The sub-folder structure will be fixed for all other users. Please see the below example and it would be great if any one can help me with the "Database Script".
Thanks and regards,
Kaustav
Solved! Go to Solution.
Hi,
You can use this code:
var rootLabel = 'Wells Fargo';
var prefix = 'wellsFargo';
var root = NLWS.xtkFolder.create({x:{model: 'xtkFolder', label: rootLabel, name: prefix+'Root', 'parent-id': 162522790}});
root.save();
logInfo('Root id', root.id);
// Admin
var admin = NLWS.xtkFolder.create({x:{model: 'xtkFolder', label: 'Administration', name: prefix+'Administration', 'parent-id': root.id}});
admin.save();
// Campaign
var campaign = NLWS.xtkFolder.create({x:{model: 'xtkFolder', label: 'Campaign Management', name: prefix+'CampaignMgt', 'parent-id': root.id}});
campaign.save();
(NLWS.xtkFolder.create({x:{model: 'nmsDelivery', label: 'Deliveries', name: prefix+'Deliveries', 'parent-id': campaign.id}})).save();
var typo = NLWS.xtkFolder.create({x:{model: 'xtkFolder', label: 'Typology Management', name: prefix+'TypologyMgt', 'parent-id': campaign.id}});
typo.save();
(NLWS.xtkFolder.create({x:{model: 'nmsTypology', label: 'Typology', name: prefix+'Typology', 'parent-id': typo.id}})).save();
(NLWS.xtkFolder.create({x:{model: 'nmsTypologyRule', label: 'Typology Rules', name: prefix+'TypologyRules', 'parent-id': typo.id}})).save();
// Profiles
var profiles = NLWS.xtkFolder.create({x:{model: 'xtkFolder', label: 'Profiles and Targets', name: prefix+'Profiles', 'parent-id': root.id}});
profiles.save();
(NLWS.xtkFolder.create({x:{model: 'nmsRecipient', label: 'Recipients', name: prefix+'Recipients', 'parent-id': profiles.id}})).save();
(NLWS.xtkFolder.create({x:{model: 'nmsSeedList', label: 'Seed addresses', name: prefix+'Seeds', 'parent-id': profiles.id}})).save();
(NLWS.xtkFolder.create({x:{model: 'nmsGroup', label: 'Lists', name: prefix+'Lists', 'parent-id': profiles.id}})).save();
// Resources
var res = NLWS.xtkFolder.create({x:{model: 'xtkFolder', label: 'Resources', name: prefix+'Resources', 'parent-id': root.id}});
res.save();
(NLWS.xtkFolder.create({x:{model: 'xtkXslt', label: 'XSL Stylesheets', name: prefix+'Xsl', 'parent-id': res.id}})).save();
Replace XXX with the id of your desired parent folder. It's an int and it can be found in the folder advanced properties.
To dynamically generate the following structure:
Note: the "model" key in the JSON is used to automatically set all the default parameters. You may find the values for model in \datakit\nms\eng\package\folder.xml and core.xml (look for <entities schema="xtk:folder"> node)
Note 2: the "save()" method is intelligent, it will update the folders if they already exist, no need to delete them
Note 3: some schemas don't have a folder-id, such as XSL stylesheets, so every brand will be able to see other brands XSL. You may have to hardcode a filter in the advanced parameters > restriction.
Kind regards
Hi,
You can use this code:
var rootLabel = 'Wells Fargo';
var prefix = 'wellsFargo';
var root = NLWS.xtkFolder.create({x:{model: 'xtkFolder', label: rootLabel, name: prefix+'Root', 'parent-id': 162522790}});
root.save();
logInfo('Root id', root.id);
// Admin
var admin = NLWS.xtkFolder.create({x:{model: 'xtkFolder', label: 'Administration', name: prefix+'Administration', 'parent-id': root.id}});
admin.save();
// Campaign
var campaign = NLWS.xtkFolder.create({x:{model: 'xtkFolder', label: 'Campaign Management', name: prefix+'CampaignMgt', 'parent-id': root.id}});
campaign.save();
(NLWS.xtkFolder.create({x:{model: 'nmsDelivery', label: 'Deliveries', name: prefix+'Deliveries', 'parent-id': campaign.id}})).save();
var typo = NLWS.xtkFolder.create({x:{model: 'xtkFolder', label: 'Typology Management', name: prefix+'TypologyMgt', 'parent-id': campaign.id}});
typo.save();
(NLWS.xtkFolder.create({x:{model: 'nmsTypology', label: 'Typology', name: prefix+'Typology', 'parent-id': typo.id}})).save();
(NLWS.xtkFolder.create({x:{model: 'nmsTypologyRule', label: 'Typology Rules', name: prefix+'TypologyRules', 'parent-id': typo.id}})).save();
// Profiles
var profiles = NLWS.xtkFolder.create({x:{model: 'xtkFolder', label: 'Profiles and Targets', name: prefix+'Profiles', 'parent-id': root.id}});
profiles.save();
(NLWS.xtkFolder.create({x:{model: 'nmsRecipient', label: 'Recipients', name: prefix+'Recipients', 'parent-id': profiles.id}})).save();
(NLWS.xtkFolder.create({x:{model: 'nmsSeedList', label: 'Seed addresses', name: prefix+'Seeds', 'parent-id': profiles.id}})).save();
(NLWS.xtkFolder.create({x:{model: 'nmsGroup', label: 'Lists', name: prefix+'Lists', 'parent-id': profiles.id}})).save();
// Resources
var res = NLWS.xtkFolder.create({x:{model: 'xtkFolder', label: 'Resources', name: prefix+'Resources', 'parent-id': root.id}});
res.save();
(NLWS.xtkFolder.create({x:{model: 'xtkXslt', label: 'XSL Stylesheets', name: prefix+'Xsl', 'parent-id': res.id}})).save();
Replace XXX with the id of your desired parent folder. It's an int and it can be found in the folder advanced properties.
To dynamically generate the following structure:
Note: the "model" key in the JSON is used to automatically set all the default parameters. You may find the values for model in \datakit\nms\eng\package\folder.xml and core.xml (look for <entities schema="xtk:folder"> node)
Note 2: the "save()" method is intelligent, it will update the folders if they already exist, no need to delete them
Note 3: some schemas don't have a folder-id, such as XSL stylesheets, so every brand will be able to see other brands XSL. You may have to hardcode a filter in the advanced parameters > restriction.
Kind regards
Thanks Florian for you quick help..!!
I will check the code and will let you know in case of any issues.
Views
Replies
Total Likes
Views
Replies
Total Likes
Hi floriancourgey
Really appreciate your help.
Just wanted to know if workflow should be initiated by current account(mentioned in script) or can be done with any other account.
I ran with different account and there was no difference in folder structure of account mentioned in script.
@kaustavg32220862,
were you able to achieve this.
Regards
Views
Replies
Total Likes
Hi Assariarra,
I think we can execute this code using normal “admin” account.
iI didn’t get a chance since I am on leave.
@floriancourgey - correct me if I am wrong.
Regards,
Kaustav
Views
Replies
Total Likes
Hi Floriancourgey,
Can you please let me know how to get the [folder-id] of the main "Root" folder?
I am checking into xtk:folder schema but I am not able to get the same.
And when I am trying to see the details by checking the properties of the folder I am only getting the "List of subfolders".
Regards,
Kaustav
Views
Replies
Total Likes
Hi,
It's 0:
Best regards
Views
Replies
Total Likes
Thanks Florian, but I have one more question. Is your code going to cover the permission also?
Views
Replies
Total Likes
And also, I need to put "0" as the parent_id if I have to create the tree structure under main root folder correct?
Views
Replies
Total Likes
Hi Floriancourgey,
I have executed the code but it created all the generic folders.Meaning "Administration" is not having proper "Admin" process folder. "Campaign Management" is also not having proper "process" folder.
Ideally it should create the proper process folder. Please refer the screenshot below: Is that something you can help along with proper access rights?
Views
Replies
Total Likes
Hi Floriancourgey,
Also find below the access rights for the folders.
Operator Groups | ||||||
<<Folder Name>> as Input in the script(For e.g. – Wells Fargo) | Admin | Marketing Admin | Campaign Manager | Comments | ||
Sub-Folders Tree Structure |
|
|
|
| ||
Administration | Access Management | Operators | CRUD | CRU | R | |
Operators Groups | CRUD | CRU | R | |||
Named rights | CRUD | CRU | R | |||
Configuration | CRUD | CRU | R | |||
Campaign Management | Deliveries | CRUD | CRU | CR | ||
Typology Management | Typologies | CRUD | CRU | R | ||
Typology rules | CRUD | CRU | R | |||
Campaigns | ||||||
Campaign WF | CRUD | CRU | CR | |||
Profiles and Targets | Seed addresses | CRUD | CRU | R | ||
Recipients | CRUD | CRU | R | |||
Lists | CRUD | CRU | R | |||
Resources | Campaign templates | CRUD | CRU | CR | ||
XSL style sheets | CRUD | CRU | CR | |||
File resources | CRUD | CRU | CR | |||
Web apps | CRUD | CRU | CR | |||
Delivery templates | CRUD | CRU | CR |
Views
Replies
Total Likes
Hi Floriancourgey,
I have modified the Jaavscript to create the appropriate folder. The only thing I am stuck is to add "Access Rights/Permissions" to the folders baed on the Operator Groups.
Please refer the table mentioned above.
Regards,
Kaustav
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies