Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Brazilian CPF Field Number

Hi all,
I am needing help to be able to create a ticket creation form with a numeric field that allows me to load the Brazilian document number with this format:
 000.000.000-00 and that the validation does not error when the user loads this value, any suggestions? with dots and dashes.

The other thing is that it cannot be repeated, I have to verify that the value of the field is unique in each case, it cannot be repeated when the end user loads another ticket.

Someone who can urinate me how to do this?

Thank you so much.

Diego.

image.pngimage.png

2 answers

2 accepted

Hello.

First of all i think you need not numberic, but text field.
Second you need write Regex Validator to verify, the entered value corresponds to format what you need.
Set description for your custom field like "enter CPF № in 000.000.000-00 format"
You can use standart Workflow 'Regular Expression Check' Validator to Restrict Text Field in Number Format, and set validator to: ^[0-9]{3}\.[0-9]{3}\.[0-9]{3}-[0-9]{2}$
Using Workflow 'Regular Expression Check' Validator to Restrict Text Field in Number Format
But in this case jira show useless error message for user, in case if entered value wrong like: "Field CPF with actual value 000x000.000-00 does not match regular expression ^[0-9]{3}\.[0-9]{3}\.[0-9]{3}-[0-9]{2}$"

CPF.png
Another good option try to use Validation based on regular expression and sctipt plugin like power script from cprime. Validation based on regular expression
With power script you also can actually check if any other issue exist with same value, using jql search for this.

UPD

Unfortunately, I do not know how to verify the uniqueness of a field without using third-party tools.
It's look like, you can try to use this free plugin:
Unique Regex Custom Field
It must do all what you need.

Another option try to write your own plugin for validation Creating workflow extensions.

Alex

Hi Alex,

Thank you for your prompt and successful response.
Apparently your sulfation works well, how can I not put a value that is already used? Does the CPF field be unique for each ticket?

Because this value is an identification number "ID"

Adding this Java Scrip as validation is possible?

https://www.geradorcpf.com/javascript-validar-cpf.htm

function validarCPF(cpf) { 
 cpf = cpf.replace(/[^\d]+/g,''); 
 if(cpf == '') return false; 
 // Elimina CPFs invalidos conhecidos 
 if (cpf.length != 11 || 
  cpf == "00000000000" || 
  cpf == "11111111111" || 
  cpf == "22222222222" || 
  cpf == "33333333333" || 
  cpf == "44444444444" || 
  cpf == "55555555555" || 
  cpf == "66666666666" || 
  cpf == "77777777777" || 
  cpf == "88888888888" || 
  cpf == "99999999999")
   return false;  
 // Valida 1o digito 
 add = 0; 
 for (i=0; i < 9; i ++)  
  add += parseInt(cpf.charAt(i)) * (10 - i); 
  rev = 11 - (add % 11); 
  if (rev == 10 || rev == 11)  
   rev = 0; 
  if (rev != parseInt(cpf.charAt(9)))  
   return false;  
 // Valida 2o digito 
 add = 0; 
 for (i = 0; i < 10; i ++)  
  add += parseInt(cpf.charAt(i)) * (11 - i); 
 rev = 11 - (add % 11); 
 if (rev == 10 || rev == 11) 
  rev = 0; 
 if (rev != parseInt(cpf.charAt(10)))
  return false;  
 return true;   
}

Ok, I use the first answer, Jira's plug-ins are all too expensive for our country. So much of not using addons.

Thanks for your answer.

 

For the purpose of validating that it is still unique, is there no way to do it without installing a plug-in?

Unfortunately, I do not know how to verify the uniqueness of a field without using third-party tools.
It's look like, you can try to use this free plugin:
Unique Regex Custom Field
It must do all what you need.

Another option try to write your own plugin for validation Creating workflow extensions.

here is the boolean expresion for check duplicate field value:

 

Only if the following boolean expression is true: count(filterByValue(fieldValue(%{field_number}, filterByIssueType(getIssuesFromProjects("project_name"), "issue_name" ) ) , =, %{field_number})) = 0

 

Is a Validator in when "Create" for example.

 

Greetins 

Diego-

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Service Management

JSM June Challenge #2: Share how your business teams became ITSM rockstars

For JSM June Challenge #2, share how your non-technical teams like HR, legal, marketing, finance, and beyond started using Jira Service Management! Tell us: Did they ask to start using it or...

326 views 9 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you