Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,463,641
Community Members
 
Community Events
176
Community Groups

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

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-

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?

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events