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.
#785784
I'd like to add a link to preview the dynaforms that are shown in the case history. I'm new to PM so if anyone can direct me to the php, classes etc to change I would really appreciate it.

I know you can click on the dynaforms menu in the information drop down and preview the forms, but this shows all the dynaforms not just the ones that have been completed and there is no date field here to check when that form was completed.

So ideally the case history would be the best place to insert the preview link to the dynaform.

Any help ?
Last edited by gresham on Fri Jun 24, 2016 9:41 am, edited 1 time in total.
#785791
You can start by looking at these files in the source code:
workflow/engine/methods/cases/caseHistory_Ajax.php
workflow/engine/methods/cases/caseMessageHistory_Ajax.php
workflow/engine/methods/cases/casesHistoryDynaformPage_Ajax.php
workflow/engine/templates/cases/caseHistory.html
workflow/engine/templates/cases/caseHistory.js
workflow/engine/templates/cases/caseHistoryDynaformPage.html
workflow/engine/templates/cases/caseHistoryDynaformPage.js
workflow/engine/templates/cases/caseMessageHistory.html
workflow/engine/templates/cases/caseMessageHistory.js
workflow/engine/templates/cases/cases_DynaformHistory.html
workflow/engine/templates/cases/cases_DynaformHistory.php
workflow/engine/xmlform/cases/cases_DynaformHistory.xml

good luck.
#785804
Sorry one more thing,

Would it be easier to just add the fields like date completed and status of the dynaform in the [information--->Dynaforms] dropdown ?

What files would i need to look at for these changes?
#785819
There is currently a bug in PM with Information > DynaForms, that causes it to not show the list of DynaForms. You can hunt through the code to try and figure out where this is, but it is generally easier to create a plugin which adds a new top menu or an option in the Home sidebar, rather than hack the PM source code. You can use REST in your plugin code.
#785847
This is a reported bug? We should fix that gaiz :P .
Anyhow, gresham i want to tell that what amosbatto is saying is right....you should make a plugin for all the custom things you will need.It will be much easier that searching for hours through the huge codebase of PM (been there....done that :P). If you are familiar with the codebase of PM you may do what you need by editing core PM code but if you are not familiar just make a plugin and it will all be easier.
#785848
hey look what i got.

If you make a plug in and want the preview of a specific Dynaform all you got to do is to put in the URL the needed info
http: //server/sysPAMT/el/neoclassic/cases/casesHistoryDynaformPage_Ajax?actionAjax=historyDynaformGridPreview&DYN_UID=262511151575dece6c22710063944032

To find this link for you PM open some browser developer tool and go to network.There you can see what links the PM calls.For example going at Information > DynaForms....select a form and press preview you will see that a similar link like the one above will be called.So at your plugin you can use this link....edited with the appropriate info...and you will get the preview of the form.

If you check again the demo plugin https://github.com/sapila/ProcessMakerDemoPlugin i added the rowdoubleclick event to get to the page of case-info and the functionality that other caselists provide.I used a similar link like the above that gets me that page.Maybe not the best way...but it is way...
Check it out you will understand!!
#785898
nikG999 wrote: If you check again the demo plugin https://github.com/sapila/ProcessMakerDemoPlugin i added the rowdoubleclick event to get to the page of case-info and the functionality that other caselists provide.I used a similar link like the above that gets me that page.Maybe not the best way...but it is way...
Check it out you will understand!!
Works just as you said to open up the case information. Just one thing, the host is hardcoded to localhost, maybe try using a dynamic link like
http://wiki.processmaker.com/3.0/JavaSc ... Name.28.29
in the DemoApplication.php file :)
#785900
I understand that to get a specific dynaform page, i could look at the inspector in chrome and get the UID, but would it be possible to generate the URL's inside a dynaform?

So is there a PM variable that contains the dynaforms UID's for all forms in that case? I could use the Href Link and then with the generated url's simply allow the user to click on the link and view the past dynaforms for that case.
#785901
Gresham,
Add a string variable named "objectsJson" to your process.

Create the following trigger to generate a list of the DynaForms for the current case. Set it to fire before the DynaForm:
Code: Select all
$caseId = @@APPLICATION;
@=aObjects = array();

$query = "SELECT AC.TAS_UID, AC.DEL_INDEX, AC.APP_TAS_TITLE, 
S.STEP_TYPE_OBJ, S.STEP_UID_OBJ, S.STEP_POSITION 
FROM APP_CACHE_VIEW AC, STEP S 
WHERE AC.APP_UID='$caseId' AND AC.TAS_UID=S.TAS_UID 
ORDER BY AC.DEL_INDEX, S.STEP_POSITION";
$aSteps = executeQuery($query);

foreach ($aSteps as $aStep) {
   if ($aStep['STEP_TYPE_OBJ'] != 'DYNAFORM')
      continue;
   $d = new Dynaform();
   $aForm = $d->Load($aStep['STEP_UID_OBJ']);
   
   @=aObjects[] = array(
      'taskTitle' => $aStep['APP_TAS_TITLE'],
      'formTitle' => $aForm["DYN_TITLE"],
      'url' => '../cases/cases_Step?TYPE=DYNAFORM&UID='.$aStep['STEP_UID_OBJ'].
          '&POSITION='.$aStep['STEP_POSITION'].'&ACTION=VIEW' //or "&ACTION=EDIT"
      );
}
@@objectsJson = json_encode(@=aObjects);
Add a hidden field to your DynaForm which is associated with the "objectsJson" variable.

Then, in your DynaForm add the JavaScript code:
Code: Select all
var aObjs = JSON.parse( $("#objectsJson").getValue() );
for (var i = 0; i < aObjs.length; i++) {
    var url = aObjs[i].url;
    //do something with the URL
}
Another option is to place the URLs in a grid and display them in the form. See the documentation on grids.
#785936
Just made a single change to the URL
Code: Select all
'url' => '../cases/casesHistoryDynaformPage_Ajax?actionAjax=historyDynaformGridPreview&DYN_UID='.$aStep['STEP_UID_OBJ']
This allows the dynaform to only be viewed without editing. When i used your ACTION=VIEW i was still able to view and edit the form :wink:

I am so happy that I found https://essaywriter.org[…]

Hi, Is there any method, e.g. by trigger, during […]

Hi, Please check the following link: http://pmle[…]

Where is processmaker-3.5.x.tar.gz ?

Hi, Please check this link: https://sourceforge.ne[…]