Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Description

...

Administering the Sharing Process

Download the example model at the bottom of this page. To import the model into yuuvis RAD designer, follow these steps:

  1. Copy the downloaded .bpmdef file into your yuuvis RAD designer project directory and open the designer.
  2. Create a model with same namespace and name of the model (namespace: "Sharing", name: "SharingVx" where x is the version number) you just downloaded and moved into your project directory.

...

Configuring the main activity

 

It is configured that the process is only startable with an object, more precisely any document on the system. You can configure the startable object types in the main activity settings.

...

Version 4

Code Block
languagejs
titleBeforeStartEvent Script
linenumberstrue
var processFile = $.file.get();            // get all process file objects into the array processFile
var dmsObject = processFile[0];            // take the first element 

// set process subject
$.variable('objecttitleobjectTitle').value = dmsObject.title;
$.variable('objecttypenameobjectTypeName').value = dmsObject.type;

// share the object with the organisational units set in usersgroups
// take into account that this code will echange the current sharing values of the object type
var putBody = {
	query: {
		expression: [dmsObject.id],
		type: dmsObject.type
	},
 	share: {
		with: [],
		children: false,
		mode: "ADD"
	}
};

var usersgroupsusersGroups = $.variable('usersgroupsusersGroups').value;
for(var i = 0; i < usersgroupsusersGroups.length; i++){
	var usergroupnameuserGroupName = $.http
	.get()
	.path('/service/organization/id/' + usersgroupsusersGroups[i].value)
	.execute()
	.data.name;
	
	putBody.share.with.push(usergroupnameuserGroupName);
}

var response = $.http
	.put()
	.path('/service/dms/batch')
	.body(putBody)
	.execute();

if(!response.reason) {
    $.variable('canbesharedcanBeShared').value = true;
} else {
	$.variable('canbesharedcanBeShared').value = false;
}

$.done();


...

Code Block
languagejs
titleBeforeStartEvent of sharemulti
// Set all participants
var usersgroupsusersGroups = $.variable('usersgroupsusersGroups').value;
for(var i = 0; i < usersgroupsusersGroups.length; i++){
  	var usergroupuserGroup = usersgroupsusersGroups[i].value;
	var recipient = new $.OrgObject();
	recipient.id = usergroupuserGroup;
	$.activity('this').performers.push(recipient);
}

$.done();

...