How to use javascript to show part of str of customfield value

Hello dear eazyBI Supportor

I have one user type custom field, its display value format always like format “XE/PE (XXXX)(UAES-XE/PSW3)”. I want it shows just a part of it, like just keep “XXXX”,

How can I make the javascript code when I make data import to eazy bi?

Looking for some response. Thanks a lot

Hi @jyjyjyjyj

Try this custom Javascript code in the import options page > additional options tab for your Jira single-user picker field.
https://docs.eazybi.com/eazybi/data-import/data-from-jira/advanced-data-import-options/custom-javascript-code

if(issue.fields.customfield_12241 && 
   issue.fields.customfield_12241.displayName && 
   issue.fields.customfield_12241.displayName.length > 11) 
{
  var inputString = issue.fields.customfield_12241.displayName;
var regex = /\((.*?)\)/; // Regular expression to match the content within parentheses
var matches = regex.exec(inputString);
}

if (matches && matches.length > 1) {
  var extractedContent = matches[1];
  issue.fields.customfield_12241.displayName = extractedContent; 
}

Martins / eazyBI support