Validator not affecting while importing data from csv file

I am trying to import vendor list from csv. While creating Issue as Vendor name I have applied validator for existing vendor name. It is affecting while creating vendor manually. But it is not affecting while creating vendor while importing from csv


2 answers

1 vote

CSV imports bypass all validation other than "summary is mandatory".  You'll need to get your data correct in the source CSV, rather than rely on whatever your validators do.

0 votes
Vasiliy Zverev Community Champion Dec 27, 2015

You could use some script to import issues. I used this script to import a lot of issues from some source (~ 2 000 issues). It could be executed via ScriptRunner. I merged requlred values into a strings with "#" separtor from all sources, parced it into script and create issues. 

import com.atlassian.jira.bc.issue.IssueService
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.IssueInputParameters
import com.atlassian.jira.project.Project
import com.atlassian.jira.project.ProjectManager
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.util.ErrorCollection

 * Скрипт по заливке запросов из файла Excel

String[] splitedImpStr = new String[3];
final String prjKeyPrefix = "MSC"
String result = "";

ApplicationUser curAppUser = ComponentAccessor.jiraAuthenticationContext.getUser();
ProjectManager prjMng = ComponentAccessor.getProjectManager();

//подготавливаем создание запроса
IssueService issueService = ComponentAccessor.getIssueService();
IssueInputParameters inputParameters = issueService.newIssueInputParameters();

//Цикл по созданию запросов
for(String curImportedStr: getStringsForImport()){
    splitedImpStr = curImportedStr.split("##")


    Project curPrj = prjMng.getProjectObjByKey(prjKeyPrefix + getPrjNmb(splitedImpStr[1]));
    if(curPrj == null)
        return "Проект не найден"

    .setSummary("Еженедельный отчет")
    .addCustomFieldValue(10807, getValue(splitedImpStr[2]));

    IssueService.CreateValidationResult createValidationResult = issueService.validateCreate(curAppUser, inputParameters);
    ErrorCollection errorCollection = createValidationResult.getErrorCollection();
    result = errorCollection.toString();

        IssueService.IssueResult createResult = issueService.create(curAppUser, createValidationResult);

            return "Bad"

return result;

public String getDueDate(int _week){
    Calendar dueDate = Calendar.getInstance();
    dueDate.set(Calendar.WEEK_OF_YEAR, _week);

    return dueDate.get(Calendar.DAY_OF_MONTH) + "/" + (dueDate.get(Calendar.MONTH) + 1) + "/" + dueDate.get(Calendar.YEAR);

public int getPrjNmb(String _forParsing){
    String prjNmb = "";
    for(Character ch: getValue(_forParsing))
        if( ch.isDigit() )
            prjNmb += ch;

    return Integer.parseInt(prjNmb);

public String getValue(String _input){
    return _input.substring(_input.indexOf("=") + 1, _input.length())

public List<String> getStringsForImport(){
    List<String> stringsForImport = new ArrayList<String>();

    return stringsForImport;

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Sep 25, 2018 in Jira

Atlassian Research Workshop opportunity on Sep. 28th in Austin, TX

We're looking for participants for a workshop at Atlassian! We need Jira admins who have interesting custom workflows, issue views, or boards. Think you have a story to sha...

454 views 7 5
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you