Skip to main content
October 18, 2023
Question

Data manipulation in order to make record type

  • October 18, 2023
  • 4 replies
  • 0 views

Hi All ,

In the attached Screenshot, two values are shown for the project ID, and I want the custom field name to repeat itself twice and the custom field id to repeat itself twice as well. 

I've added code snippet to what I've currently written for reference  and 

Output should look like this 


map

project id  list of number(integer)-2 items
   18800 (number(integer))

   12405 (number(integer))

customFieldName  list of (Text)-2 items

   "2nd Outreach" (Text)

   "2nd Outreach" (Text)

customFieldId. List of Number (Integer) -2 items

   28306 (number(integer))

   28306 (number(integer))

a!localVariables(
  local!result: rule!LGH_intCustomFieldsGET(),
  local!rows: if(
    condition: index(local!result, "success", false),
    valueIfTrue: local!result.result.body.values,
    valueIfFalse: {}
  ),
  a!forEach(
    local!rows,
    a!map(
      projectId: index(fv!item, "projectIds", {}),
      name: index(fv!item, "name", {}),
      customFieldId:index(fv!item, "numericId", {})
    )
  )
)

4 replies

stefanhelzle0001
Brainy
October 18, 2023

Having fun with Jira?

a!localVariables(
  local!result: rule!LGH_intCustomFieldsGET(),
  local!rows: if(
    condition: index(local!result, "success", false),
    valueIfTrue: local!result.result.body.values,
    valueIfFalse: {}
  ),
  a!forEach(
    local!rows,
    a!map(
      projectId: {
        index(fv!item, "projectIds", {}),
        index(fv!item, "projectIds", {})
      },
      name: index(fv!item, "name", {}),
      customFieldId: {
        index(fv!item, "numericId", {}),
        index(fv!item, "numericId", {})
      }
    )
  )
)

October 18, 2023

Thanks for your response, can we make it ,dynamic based on the project id.  The second map in the screenshot is showing four project ids.

stefanhelzle0001
Brainy
October 18, 2023

Well, you can create that list using any logic you need.