Share ideas, ask questions, and get feedback about developing for ProcessMaker

Moderators: ArturoRobles, ArturoRobles

Forum rules: Please post new questions under "Developing processes & programming" for ProcessMaker 2 or 3.
amosbatto wrote:You only need to use the newCase() web service if you are creating this new case outside ProcessMaker. If you are inside ProcessMaker, you can call PMFNewCase() in a trigger fired after the DynaForm.

If you can't figure it out, then post the code you are using or attach your process where you have tried to implement it.

i want to call startCase page in javascript in my project. but i cant do this.
i connect with PM in my project.
can you help me?
If you are in a DynaForm in ProcessMaker 3, then you can use this JavaScript code to create a new case:
Code: Select all
var host = PMDynaform.getHostName();                // get the hostname
var ws = PMDynaform.getWorkspaceName();             // get the current workspace
var token = PMDynaform.getAccessToken();            // get the access Token
//var caseId = frames.app_uid ? frames.app_uid : '';  // get the case ID
var processId = "2834197345a2a09e94b2ed5000427982"; //3 ID of the process where a new case is created
var taskId = "8698940655a2a0a0c6ed945011892536";    //ID of the starting task in process

var oVarsInCase = {
  "amount":     23.45,
  "name":       "Widgets, Inc",
  "address":    "2375 Southwestern Av.\nCompton NJ 27464",

var oPostVars = {
  'pro_uid':   processId,
  'tas_uid':   taskId,
  'variables': oVarsInCase

$("#createCase").find("button").click( function() {  
        url: host+"/api/1.0/"+ws+"/cases", // REST endpoint
        data: JSON.stringify(oPostVars),                         
        type: "POST",
        contentType: "application/json",
        //dataType: 'application/json', //set to 'text' if no response
        beforeSend: function(xhr) {
          xhr.setRequestHeader('Authorization', 'Bearer '+token); // Header with access token
        success: function(xhr, status, error) {
          alert("Case number: "+xhr.app_number+"\nCase ID: "+xhr.app_uid);  
        error: function(xhr, status, error) {
          if (xhr.status == 400 && xhr.responseJSON) {
            alert("Error: "+ xhr.responseJSON.error.message);
          else {
            alert("Error! Ready state: "+xhr.readyState+"\nHTTP status code: "+xhr.status); 
Where "createCase" is the ID of a button. You have to set the IDs of the process and starting task in the code. If you want to start a case for a user who isn't the logged-in user, then you need to use the POST case/impersonate endpoint.

If you are designing an external web page, then import the jquery.js file and you can use the above code, but you will have to change the variables at the top to match your system:
Code: Select all
var host = "";                // get the hostname
var ws =  "workflow";                                // get the current workspace
var token = 'XXXXXXXXXXXXXXXXX'; // use $.ajax() to login and get the access token.
See: ... ry_example

Maybe try increasing your thread stack size? Seems[…]

I use PM 3.4. Android push works while IOS push do[…]

[quote=ziadeh post_id=823031 time=1550759948 user_[…]

I have to support reports in processmaker 3.4. A s[…]