06-15-2011 12:49 PM
06-30-2011 04:43 AM
var xmlfile = "the noderef of your xmlfile";
var workflowDefinition = workflow.getDefinitionByName("jbpm$youradvancedworkflow");
var workflowPackage = workflow.createPackage();
workflowPackage.addNode(xmlfile);
var workflowParameters = [];
var workflowPath = workflowDefinition.startWorkflow(workflowPackage, workflowParameters);
// End the start task
var tasks = workflowPath.getTasks();
for (task in tasks)
{
tasks[task].endTask(null);
}
07-04-2011 05:20 AM
<webscript>
<shortname>My dashlet name</shortname>
<description>A description</description>
<family>user-dashlet</family>
<url>/components/dashlets/mycustomdashlet</url>
</webscript>
<#assign userIsAuthorized = results["isAuthorized"]>
<div class="dashlet">
<div class="title">Complete the Form</div>
<div class="body">
<#if userIsAuthorized = "true">
<form action="${url.serviceContext}/createXmlAndLauch" method="post" enctype="multipart/form-data" accept-charset="utf-8">
<h4>Form</h4>
<table>
<tr>
<td><label for="name"><strong>Name : </strong></label></td>
<td><input name="name" value="" /></td>
</tr>
<tr>
<td><label for="age"><strong>Age : </strong></label></td>
<td><input name="age" value="" /></td>
</tr>
…
<tr>
<td><input type="submit" name="submit" value="Send"></td>
</tr>
</table>
</form>
<#else>
You're not authorized to complete the form.
</#if>
</div>
</div>
var connector = remote.connect("alfresco");
var data = connector.get("/sample/mycustomdashlet_prop.json);
// create json object from data
var result = eval('(' + data + ')');
model.results = result["data"];
<webscript>
<shortname>Mycustomdashlet Properties</shortname>
<description>Gives informations to the dashlet mycustomdashlet</description>
<url>/sample/mycustomdashlet_prop.json</url>
<authentication>user</authentication>
<transaction>required</transaction>
</webscript>
var groups = people.getContainerGroups(person);
var authorized = false;
for (var group in groups){
if(group == people.getGroup("GROUPS_myAuthorizedGroup"){
authorized = true;
}
}
model.Authorized = authorized;
{
"data" :
{
"isAuthorized" : "${Authorized?string}"
}
}
<webscript>
<shortname>CreateXmlAndLauch webscript</shortname>
<description>gather information from form, create an xml file and launch an advanced workflow</description>
<url>/sample/createXmlAndLauch</url>
<authentication>user</authentication>
<transaction>required</transaction>
</webscript>
var name=args["name"];
var age=args["age"];
…
var Header = '<?xml version="1.0" ?>\n';
var Content = '<name>'+name+'</name>\n'
+'<age>'+age+'</age>\n'
+'…\n'
+'…\n';
//Creation of the xml file
var xmlFile=person.properties["cm:homeFolder"].createNode('myNewXmlFile.xml');
xmlFile.content=Header+Content;
xmlFile.save();
//start workflow
var workflowDefinition = workflow.getDefinitionByName("jbpm$youradvancedworkflow");
var workflowPackage = workflow.createPackage();
workflowPackage.addNode(xmlFile);
var workflowParameters = [];
var workflowPath = workflowDefinition.startWorkflow(workflowPackage, workflowParameters);
var tasks = workflowPath.getTasks();
for (task in tasks){
tasks[task].endTask(null);
}
var mail = actions.create("mail");
var to = "" ;
var from = "" ;
var subject = "" ;
mail.parameters.to = to ;
mail.parameters.subject = subject ;
mail.parameters.from = from ;
var mailText = "blablabla";
mail.parameters.text = mailText;
mail.execute(bpm_package);
var Content = 'blablabla';
var file=person.properties["cm:homeFolder"].createNode('file.txt');
file.content=Content;
file.save();
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.