You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

ConnectionManager.post(url, callback, params)

Description
Ajax POST to a specific URL

Parameters

  • url - URL to POST
  • callback - a callback function after the POST is succeeded (optional)
  • params - parameters for the POST (optional)

Sample Code

var callback = {
success : function(response){
  //do something
}
ConnectionManager.post('http://localhost/test', callback, 'id=2')

ConnectionManager.ajaxJsonp(url, callback, params)

Description
Initiate Ajax call with JSONP

Parameters

  • url - URL to initiate Ajax call
  • callback - a callback function after the call is succeeded (optional)
  • params - parameters for the call (optional)

Sample Code

var callback = {
  success : function(response){
    //do something
  }
}
ConnectionManager.ajaxJsonp('http://localhost/test', callback, 'id=4')


ConnectionManager.get(url, callback, params, xss)

Description
Ajax GET to a specific URL

Parameters

  • url - URL to GET
  • callback - a callback function after the GET is succeeded (optional)
  • params - parameters for the GET (optional)
  • xss - use when the URL is cross-domain (optional)

Sample Code

var callback = {
  success : function(response){
    //do something
  }
}

ConnectionManager.get('http://localhost/test', callback, 'id=6')

AssignmentManager.getCurrentUsername(baseUrl, callback)

Description
Get the current logged in username in Joget Workflow

Parameters

  • baseUrl - base URL of Joget Workflow, eg. 'http://localhost/jw'
  • callback - a callback function after the call is succeeded (optional)

Sample Code

var callback = {
  success : function(response){
    //response.username
  }
}
AssignmentManager.getCurrentUsername('http://localhost/jw', callback);


AssignmentManager.login(baseUrl, username, password, callback)

Description
Login / Single Sign On (SSO) to Joget Workflow with the username & password

Parameters

  • baseUrl - base URL of Joget Workflow, eg. 'http://localhost/jw'
  • username - username of the user to login
  • password - password of the user to login
  • callback - a callback function after the login is succeeded (optional)

Sample Code

var callback = {
  success : function(response){
    //do something
  }
}

AssignmentManager.login('http://localhost/jw', 'admin', 'admin', callback);

AssignmentManager.login(baseUrl, username, hash, callback)

Description
Login / Single Sign On (SSO) to Joget Workflow with the username & hashed password. 

Parameters

  • baseUrl - base URL of Joget Workflow, eg. 'http://localhost/jw'
  • username - username of the user to login
  • hash - hashed password (refer to Hashed Password)
  • callback - a callback function after the login is succeeded (optional)

Sample Code

var callback = {
  success : function(response){
    //do something
  }
}

AssignmentManager.login('http://localhost/jw', 'admin', '14ACD782DCFEB2BCDE2B271CCD559477', callback);

AssignmentManager.logout(baseUrl)

Description
Logout the user in Joget Workflow

Parameters

  • baseUrl - base URL of Joget Workflow, eg. 'http://localhost/jw'

Sample Code

AssignmentManager.logout('http://localhost/jw');

AssignmentManager.withdrawAssignment(baseUrl, activityId)

Description
Withdraw an assignment with a specific activity instance id

Parameters

  • baseUrl - base URL of Joget Workflow, eg. 'http://localhost/jw'
  • activityId - activity instance id of the assignment to withdraw

Sample Code

AssignmentManager.withdrawAssignment('http://localhost/jw', '1_1_activity');

AssignmentManager.completeAssignment(baseUrl, activityId, redirect)

Description
Complete an assignment with a specific process instance id & activity instance id

Parameters

  • baseUrl - base URL of Joget Workflow, eg. 'http://localhost/jw'
  • activityId - activity instance id of the assignment to complete
  • redirect - an URL to redirect after the assignment is completed (optional)

Sample Code

AssignmentManager.completeAssignment('http://localhost/jw', '1_1_activity', 'http://localhost/completed.jsp');

AssignmentManager.completeAssignmentWithVariable(baseUrl, activityId, variableData, redirect)

Description
Complete an assignment with a specific process instance id & activity instance id

Parameters

  • baseUrl - base URL of Joget Workflow, eg. 'http://localhost/jw'
  • activityId - activity instance id of the assignment to complete
  • variableData - Joget Workflow variable data to update for the assignment
  • redirect - an URL to redirect after the assignment is completed (optional)

Sample Code

AssignmentManager.completeAssignmentWithVariable('http://localhost/jw', '1_1_activity', 'status=new&id=123', 'http://localhost/completed.jsp');

UrlUtil.encodeUrlParam(url)

Description
Encoding url with parameters

Parameters

  • url - url to be encode

Sample Code

UrlUtil.encodeUrlParam('http://localhost/test?id=123#4#5678&status=abc efg');

getUrlParam(paramName)

Description
Get the value of a URL parameter

Parameters

  • paramName - name of the parameter to get

Sample Code

If the current URL is 

getUrlParam('id')

will return 123, while

getUrlParam('page')

will return 2

  • No labels