Custom Fields not working as intended

Greetings,

I have created a custom field in eazybi imports but it does not check the conditions that I have it.
I am trying to create a new measure for which I convert story points to other numbers based on teams. here is the code ;
// The actual custom field IDs for teams and story points
var team = issue.fields.customfield_10700;
var storyPoints = issue.fields.customfield_10006;

// The conversion map
var teamToConversionMap = {
“Lion”: {
1: 3.2,
2: 4.4,
3: 3.6,
5: 12,
8: 16,
},
// Add mappings for other teams as needed
};

// Convert the story points
var convertedPoints = null;
if (team && storyPoints) {
var teamConversionMap = teamToConversionMap[team];
if (teamConversionMap && teamConversionMap[storyPoints]) {
convertedPoints = teamConversionMap[storyPoints];
}
}

// Return the converted value or null
return convertedPoints;

anyone knows that the problem is?
Thanks

Hi @Said_Ouassou

A couple of questions on this:

In which section did you use this custom JavaScript code? In Advanced settings, new calculated fields or additional options?

Could you explain what exactly the problem is? How is it not working as intended? Is the wrong result showing up? Is the correct result showing up in the wrong place? Does nothing show up?

Any additional details would be appreciated!
​Best regards,
​Nauris / eazyBI support

Hello Nauris,

Thanks for your reply,
the section is in Advanced settings, new calculated fields

and I get null which is the value initially set for convertedPoints, meaning that the if condition is not met.

Do you have any suggestion?

to give more info on the data structure , i have the info relating to the teams like this

“customfield_10700”: [
{
“id”: 142816,
“value”: “Lion”
}
],

Yet somehow I cannot access the value Lion in this case, even with var team = issue.fields.customfield_10700.value

Hi @Said_Ouassou

A couple more questions:

  1. Could you please paste the full code that you use for this field in Advanced settings (together with the parameters set for this field)?
  2. Is this on eazyBI for Jira Cloud or eazyBI for Jira Server/Data center?
  3. Is this “customfield_10700” a Jira standard custom field or is it generated by some third-party app? Also, what type of custom field is it?

Thanks!
Nauris