Page 1 of 1

ID for each case

Posted: Thu Oct 15, 2009 2:50 pm
by laraujo
Hello,

I'd like to establish an ID for each case I start in a process.

The thing is... I don't know what to use for an ID. Should I use the Case Code? the PIN? can I create an ID number of my assigned automatically for each case?

also... I need to make this ID visible on a text field in the dynaform.

what do you recommend?

thanks in advance

Re: ID for each case

Posted: Thu Oct 15, 2009 10:25 pm
by amosbatto
The cases auto-increment starting from the number 1. Each case in a process is given a new unique number, so you can use this. This number appears in the case title preceded by a hash sign "#". If you need to access it from a trigger, however, you have to use executeQuery:
$app = @@APPLICATION;
$query=executeQuery("SELECT APP_NUMBER FROM APPLICATION WHERE APP_UID='$app'");
@@CaseNo = $query[1]['APP_NUMBER'];
Then create a DynaForm field named "CaseNo" to display it in a DynaForm.

The PIN number is also unique, so you can use either one. Just depends whether you want people to know how many cases there have been. The PIN is available as a case variable @@PIN. If you name a DynaForm field "PIN", then the PIN will automatically be displayed.

Re: ID for each case

Posted: Fri Oct 16, 2009 12:58 pm
by laraujo
Thanks a lot, it works fine!

I thought of using the auto.increment number, but I found out the case number is different depending on the task's assigned user.

I decided to use the PIN solution...
If this value is unique, then it works fine.

Thank you very much!!
Have a nice day! :)

Re: ID for each case

Posted: Sat Mar 31, 2018 7:32 am
by shailoz
Hi,

I am new to ProcessMaker and suspect that I am making a basic error but I cannot see what it is ...
I tried to do exactly what you suggest but when the Dynaform is displayed the field is blank?
any suggestions as to what I may have missed.

1. I configured the trigger
2. added the step
3. Created dynafom
4. In the "steps" of step I added the trigger before the dynaform
5. I added the dynaform to the "steps"

Thank you in advance.

Shailoz

Re: ID for each case

Posted: Sat Mar 31, 2018 8:00 am
by shailoz
I just noticed it worked with @@PIN but does not work with @@APPLICATION - now I am really confused!

Re: ID for each case

Posted: Mon Apr 02, 2018 10:06 am
by amosbatto
First of all, what version of PM are you using? Those are instructions for PM 1.2 from 2009. They will probably work in PM 2, but not in PM 3.

If using PM 3, create the following string variables named "caseId", "caseNo" and "pin". Then associate those string variable with text fields in a DynaForm. Then create a trigger, with the following content:
Code: Select all
@@caseId = @@APPLICATION; 
@@caseNo = @@APP_NUMBER;
@@pin = @@PIN; 
Set this trigger to execute before your DynaForm containing the text fields.

Re: ID for each case

Posted: Mon Apr 02, 2018 9:43 pm
by shailoz
Thank you for the response. I already did something similar to your suggestion and in the process found that the "SELECT * from APPLICATIONS ..." should be APPLICATION

Problem solved!

Thanks again

Re: ID for each case

Posted: Tue Apr 03, 2018 2:23 pm
by amosbatto
Oh, thanks for catching that. I corrected the code in the original post.