Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.
Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
By Throwaway
#790882
I am interested in creating a table of contents that will allow the user to go to a specific step/form/page if more information is needed or needs to be changed upon a review.

What would be the best practice of doing this?

Example:

Test - Table of Contents

Intro Process (title)
- step 1 (link)
- step 2 (link)

Second Process
- step 1
- step 2 /multiple forms
- etc
- etc
User avatar
By amosbatto
#790886
You can only link to specific cases, so the cases in the two processes will need to already exist, before you redirect to them. If they don't already exist, then you can display a link to start the new cases. You can use executeQuery() in a trigger to search for an existing cases in the APPLICATION or APP_CACHE_VIEW tables.

If you want to link to a specific task in a case, you need to use their delegation index.
See:
http://wiki.processmaker.com/3.0/JavaSc ... rms#Frames
http://wiki.processmaker.com/3.0/JavaSc ... edirection
http://wiki.processmaker.com/3.0/Trigge ... edirection
http://wiki.processmaker.com/3.0/Intern ... ader.28.29

Once you are inside a task, you can then redirect the web browser to a step (DynaForm, Input Document or Output Document) inside that task, using PMFRedirectToStep() in PHP or with JavaScript using code like this:
Code: Select all
location.href="cases_Step?TYPE=DYNAFORM&UID=32644005656d6e2644dd616029016693&POSITION=3&ACTION=EDIT";
By Throwaway
#790899
amosbatto wrote:You can only link to specific cases, so the cases in the two processes will need to already exist, before you redirect to them. If they don't already exist, then you can display a link to start the new cases. You can use executeQuery() in a trigger to search for an existing cases in the APPLICATION or APP_CACHE_VIEW tables.

If you want to link to a specific task in a case, you need to use their delegation index.
See:
http://wiki.processmaker.com/3.0/JavaSc ... rms#Frames
http://wiki.processmaker.com/3.0/JavaSc ... edirection
http://wiki.processmaker.com/3.0/Trigge ... edirection
http://wiki.processmaker.com/3.0/Intern ... ader.28.29

Once you are inside a task, you can then redirect the web browser to a step (DynaForm, Input Document or Output Document) inside that task, using PMFRedirectToStep() in PHP or with JavaScript using code like this:
Code: Select all
location.href="cases_Step?TYPE=DYNAFORM&UID=32644005656d6e2644dd616029016693&POSITION=3&ACTION=EDIT";
I'm a little confused on what you mean by "then you can display a link to start the new cases". Couldn't it just pull the case number with @@PROCESS since it's inside of a case? I have many forms under task 1 but I would like to give them the option to move to other forms and possibly other tasks.

Best regards,
User avatar
By amosbatto
#790923
Throwaway wrote:I'm a little confused on what you mean by "then you can display a link to start the new cases".
I mean a link to start a new case:
http://example.com/sysworkflow/en/neocl ... =startCase
Throwaway wrote:Couldn't it just pull the case number with @@PROCESS since it's inside of a case? I have many forms under task 1 but I would like to give them the option to move to other forms and possibly other tasks.
If you are already inside a case, you can jump directly to any step inside the current task in that case. See these examples:
http://wiki.processmaker.com/3.0/Submit ... other_step
http://wiki.processmaker.com/3.0/Submit ... n_triggers

You can't jump to steps in different tasks in a case. First you have to call PMFDerivateCase() in a trigger to route to the other task.



You can't jump directly between different tasks in a case.
By Throwaway
#791451
amosbatto wrote:
Throwaway wrote:I'm a little confused on what you mean by "then you can display a link to start the new cases".
I mean a link to start a new case:
http://example.com/sysworkflow/en/neocl ... =startCase
Throwaway wrote:Couldn't it just pull the case number with @@PROCESS since it's inside of a case? I have many forms under task 1 but I would like to give them the option to move to other forms and possibly other tasks.
If you are already inside a case, you can jump directly to any step inside the current task in that case. See these examples:
http://wiki.processmaker.com/3.0/Submit ... other_step
http://wiki.processmaker.com/3.0/Submit ... n_triggers

You can't jump to steps in different tasks in a case. First you have to call PMFDerivateCase() in a trigger to route to the other task.



You can't jump directly between different tasks in a case.
I guess my issue would be that I don't know the particular case ID as it will be a table of contents page and I would want it to how at the beginning of the process, is there any way I can have the case ID automatically show in the redirect URL?
Code: Select all
$("#moreInfo").find("button").click(function(){
   $("form").saveForm();
   //redirect to a DynaForm which is the 3rd step in the current task
   location="../cases/cases_Step?TYPE=DYNAFORM&UID=[CASE ID]&POSITION=3&ACTION=EDIT";
});
I think this could be a potential solution, basically, I just want to have a table of contents with links or buttons to allow clients to see the steps and be able to click them to navigate if needed. It will be the first step of the task.
Code: Select all
$("#moreInfo").find("button").click(function() {
   $("#action").setValue("MORE_INFO"); //goto another DynaForm
});
User avatar
By amosbatto
#791464
In this JavaScript code:
Code: Select all
$("#moreInfo").find("button").click(function(){
   $("form").saveForm();
   //redirect to a DynaForm which is the 3rd step in the current task
   location="../cases/cases_Step?TYPE=DYNAFORM&UID=XXXXXXXXXXXXXXXXXXXX&POSITION=3&ACTION=EDIT";
});
XXXXXXXXXXXXXXXXXXXX is the unique ID of the DynaForm (not the case ID), which is fixed. Open the list of DynaForms and click on the "Show ID" button to see it.
DynaFormID.png
DynaFormID.png (25.57 KiB) Viewed 12086 times
By the way, if you use this JavaScript code, then you don't need the second bit of code you posted.
By Throwaway
#791482
amosbatto wrote:In this JavaScript code:
Code: Select all
$("#moreInfo").find("button").click(function(){
   $("form").saveForm();
   //redirect to a DynaForm which is the 3rd step in the current task
   location="../cases/cases_Step?TYPE=DYNAFORM&UID=XXXXXXXXXXXXXXXXXXXX&POSITION=3&ACTION=EDIT";
});
XXXXXXXXXXXXXXXXXXXX is the unique ID of the DynaForm (not the case ID), which is fixed. Open the list of DynaForms and click on the "Show ID" button to see it.
DynaFormID.png
By the way, if you use this JavaScript code, then you don't need the second bit of code you posted.
Thank you, seeing it clears it up fully! I guess the only question(s) left is, will the dynaform ID change in every case or will it stay the same and can I use this syntax for links as well if I wanted to use those instead of buttons?
By Throwaway
#791528
amosbatto wrote:The ID of the DynaForm is fixed. (There is an option to change its ID if you export your process and then import it.)

If you want to use links, then you will need to use the full URL something like this:
http://example.com/sysworkflow/en/neocl ... CTION=EDIT
Would it be possible to do something along the lines of making 2 hidden fields (@@TaskID and @@ProcessID = @@PROCESS and @@TASK) then somehow in Javascript access the hidden field as an input element with jquery? The only thing I can think of is with $(‘#ProcessID’).getControl().val()

PS. using trigger to assigned @@PROCESS = @@ProcessID and @@TASK = @@TaskID.
User avatar
By amosbatto
#791532
You can set hidden fields in your DynaForm by creating a trigger like this that is fired before the DynaForm:
Code: Select all
@@processId = @@PROCESS;
@@taskId = @@TASK;
Then create two hidden fields in your DynaForm which are associated with the "processId" and "taskId" variables. Then you can access those two fields in your DynaForm with this JavaScript:
Code: Select all
var processId = $("#processId").getValue();
var taskId = $("#taskId").getValue();
By Throwaway
#791582
amosbatto wrote:You can set hidden fields in your DynaForm by creating a trigger like this that is fired before the DynaForm:
Code: Select all
@@processId = @@PROCESS;
@@taskId = @@TASK;
Then create two hidden fields in your DynaForm which are associated with the "processId" and "taskId" variables. Then you can access those two fields in your DynaForm with this JavaScript:
Code: Select all
var processId = $("#processId").getValue();
var taskId = $("#taskId").getValue();
Thanks for the example! Would this also be a good way to use the processmaker API and loop through the Dynaforms/steps in a particular task for the table of contents or is there a simpler way to have the buttons go directly to another form in the same step without having to list the order out individually like so?
Code: Select all
$("#Form1").find("button").click(function(){
   $("Form1").saveForm();
   //redirect to form 1
   location="../cases/cases_Step?TYPE=DYNAFORM&UID=273740600590380904b7a98047114290&POSITION=3&ACTION=EDIT";
});
$("#Form2").find("button").click(function(){
   $("form").saveForm();
   //redirect to form 2
   location="../cases/cases_Step?TYPE=DYNAFORM&UID=27507221559038e71e8f528016360431&POSITION=4&ACTION=EDIT";
});
$("#Form3").find("button").click(function(){
   $("form").saveForm();
   //redirect to form 3
   location="../cases/cases_Step?TYPE=DYNAFORM&UID=2021067515903a0000f70e4045010102&POSITION=5&ACTION=EDIT";
});


I'm currently using buttons as the steps and this works well, but I would like to use a method as to where I won't have to manually edit it if the dynaform changes it's positioning in the steps.

Thanks for the help again, you've been great.
User avatar
By amosbatto
#791600
You could query the STEPS table in a trigger to get the list of steps for the current task and then use that information to dynamically create the HTML code for buttons to place in a panel control.

If you aren't a programmer, then the easiest solution is to train your users to use the Steps menu to navigate between steps in a task.

By the way, the code to save the current form is $("form").saveForm(). If you want to search for a particular form you need to use the ID of the form:
$("#1234567abcde12345678abced132").saveForm
By Throwaway
#791628
amosbatto wrote:You could query the STEPS table in a trigger to get the list of steps for the current task and then use that information to dynamically create the HTML code for buttons to place in a panel control.

If you aren't a programmer, then the easiest solution is to train your users to use the Steps menu to navigate between steps in a task.

By the way, the code to save the current form is $("form").saveForm(). If you want to search for a particular form you need to use the ID of the form:
$("#1234567abcde12345678abced132").saveForm
I see, could you use a simple example to show how I would query them? I'm pretty new to ProcessMaker and an in the process of signing up for the certification course. I just want to be able to allow a button on a Dynaform to link directly to another Dynaform in the step without having to list the placement :)
By Aradolfati
#828545
Escuse me does any way to send process to other process???
For Example I have sale and buy process!
and i want when i click on sumbit on end of the task
my dynaform send variable and form to sell process!
User avatar
By programerboy
#828546
Hi,
You can use sub process in your process:
https://wiki.processmaker.com/3.2/Sub-Processes

Or create new case with trigger from other process and send variable to it:
https://wiki.processmaker.com/3.3/ProcessMaker_Functions/Case_Functions#PMFNewCase.28.29

http://pmlearning.info
Thanks

Hello. For rental housing, there are software solu[…]

Experience heightened pleasure with Cenforce 100 M[…]

Get an instant solution to move emails to MBOX for[…]

Most Demanding OST to PST Converter

The most demanding OST to PST Converter is TrijaT[…]