how can i create map or key value pairs of existing attached code.

a!localVariables(
  
  local!actualData: 	
  {a!map(standardFieldId: 277, categoryId: 350, ticketTypeId: 439, providerTypeLookupRefId: 42, assignee: fn!touser("egbeyong@test.com"), slaId: 379, priorityLookupRefId: 30, statusLookupRefId: 39, subStatusLookupRefId: 49, description: "Description Auto fill", submitterLookupRefId: 8, dueDate: fn!date(2024, 9, 25), isActive: true, createdBy: fn!touser("test.test@test.com"), createdDt: fn!datetime(2024, 9, 25, 10, 26, 55, 0), updatedBy: fn!touser("test.test@test.com"), updatedDt: fn!datetime(2024, 9, 25, 10, 27, 2, 0), ticketTypeName: "Provider Data Edit", derivedTicketId: "PRVDATAEDIT-277", dueDateSpecial: fn!date(2024, 9, 25), daysLeft: -5)},
  local!data: 	
  {a!map(escalationFieldId: 14069, escalationPathwayId: 387, isRequired: true, visibilityStatusLookupRefId: fn!tointeger(null), autofillSourceFieldName: "description", autofillDestFieldName: "code", bigQueryRule: fn!tointeger(null), automationTypeLookupId: 40, isVisible: true, isActive: true, createdBy: "test.test@test.com", createdDt: fn!datetime(2024, 9, 30, 3, 54, 20, 0), updatedBy: "test.test@test.com", updatedDt: fn!datetime(2024, 9, 30, 3, 54, 20, 0), destTicketTypeId: 268, uuid: "f03b6999-c073-43b7-a584-04aa5e988710"), a!map(escalationFieldId: 14034, escalationPathwayId: 387, isRequired: true, visibilityStatusLookupRefId: fn!tointeger(null), autofillSourceFieldName: "description", autofillDestFieldName: "description", bigQueryRule: fn!tointeger(null), automationTypeLookupId: 40, isVisible: true, isActive: true, createdBy: "test.test@test.com", createdDt: fn!datetime(2024, 9, 30, 3, 54, 20, 0), updatedBy: "test.test@test.com", updatedDt: fn!datetime(2024, 9, 30, 3, 54, 20, 0), destTicketTypeId: 268, uuid: "0038a9e9-e0d3-4c36-8b50-eb97ecbbf39e"), a!map(escalationFieldId: 14032, escalationPathwayId: 387, isRequired: true, visibilityStatusLookupRefId: fn!tointeger(null), autofillSourceFieldName: "summary", autofillDestFieldName: "summary", bigQueryRule: fn!tointeger(null), automationTypeLookupId: 40, isVisible: true, isActive: true, createdBy: "test.test@test.com", createdDt: fn!datetime(2024, 9, 30, 3, 54, 20, 0), updatedBy: "test.test@test.com", updatedDt: fn!datetime(2024, 9, 30, 3, 54, 20, 0), destTicketTypeId: 268, uuid: "6c092428-7b84-465b-8131-de5d2f83477e")},
  local!actualKeys: local!3data.autofillDestFieldName,
  index(
    local!actualData,
    local!data.autofillSourceFieldName,
    {}
  ), /* returns Values of matching autofillSourceFieldName of local!data  from local!actualdata's description(Key)*/

  /*just taking an example of first map present in local!data if in local!data value of autofillSourceFieldName which is description in first map is present in the local!actualdata then key "description"  then Key value pair should be of {code:"Description Auto Fill"}code is autofillDestFieldName in local!data*/

)

Hi All ,

Let me know how should i prepare the map or key value pairs dynamically of mentioned code 

Thanks 

  Discussion posts and replies are publicly visible

Parents
  • Can you explain more on your requirement. Because you already have the map which is giving you the description based on autofillSourceFieldName.

  • Sure , In local!data, if the value of autofillSourceFieldName matches a key in local!actualData, then the output should consist of a key-value pair where the key is autofillDestFieldName from local!data and the value corresponds to the matching key in local!actualData.

  • 0
    Certified Associate Developer
    in reply to Klaus34

    Hi Klaus, I copied your code and tried, I hope this is my correct understanding for your requirement.

    a!localVariables(
    local!actualData: {
    a!map(
    standardFieldId: 277,
    categoryId: 350,
    ticketTypeId: 439,
    providerTypeLookupRefId: 42,
    assignee: fn!touser("egbeyong@test.com"),
    slaId: 379,
    priorityLookupRefId: 30,
    statusLookupRefId: 39,
    subStatusLookupRefId: 49,
    description: "Description Auto fill",
    submitterLookupRefId: 8,
    dueDate: fn!date(2024, 9, 25),
    isActive: true,
    createdBy: fn!touser("test.test@test.com"),
    createdDt: fn!datetime(2024, 9, 25, 10, 26, 55, 0),
    updatedBy: fn!touser("test.test@test.com"),
    updatedDt: fn!datetime(2024, 9, 25, 10, 27, 2, 0),
    ticketTypeName: "Provider Data Edit",
    derivedTicketId: "PRVDATAEDIT-277",
    dueDateSpecial: fn!date(2024, 9, 25),
    daysLeft: - 5,
    code:"Test",
    summary:"Testwer"
    )
    },
    local!data: {
    a!map(
    escalationFieldId: 14069,
    escalationPathwayId: 387,
    isRequired: true,
    visibilityStatusLookupRefId: fn!tointeger(null),
    autofillSourceFieldName: "description",
    autofillDestFieldName: "code",
    bigQueryRule: fn!tointeger(null),
    automationTypeLookupId: 40,
    isVisible: true,
    isActive: true,
    createdBy: "test.test@test.com",
    createdDt: fn!datetime(2024, 9, 30, 3, 54, 20, 0),
    updatedBy: "test.test@test.com",
    updatedDt: fn!datetime(2024, 9, 30, 3, 54, 20, 0),
    destTicketTypeId: 268,
    uuid: "f03b6999-c073-43b7-a584-04aa5e988710"
    ),
    a!map(
    escalationFieldId: 14034,
    escalationPathwayId: 387,
    isRequired: true,
    visibilityStatusLookupRefId: fn!tointeger(null),
    autofillSourceFieldName: "description",
    autofillDestFieldName: "description",
    bigQueryRule: fn!tointeger(null),
    automationTypeLookupId: 40,
    isVisible: true,
    isActive: true,
    createdBy: "test.test@test.com",
    createdDt: fn!datetime(2024, 9, 30, 3, 54, 20, 0),
    updatedBy: "test.test@test.com",
    updatedDt: fn!datetime(2024, 9, 30, 3, 54, 20, 0),
    destTicketTypeId: 268,
    uuid: "0038a9e9-e0d3-4c36-8b50-eb97ecbbf39e"
    ),
    a!map(
    escalationFieldId: 14032,
    escalationPathwayId: 387,
    isRequired: true,
    visibilityStatusLookupRefId: fn!tointeger(null),
    autofillSourceFieldName: "summary",
    autofillDestFieldName: "summary",
    bigQueryRule: fn!tointeger(null),
    automationTypeLookupId: 40,
    isVisible: true,
    isActive: true,
    createdBy: "test.test@test.com",
    createdDt: fn!datetime(2024, 9, 30, 3, 54, 20, 0),
    updatedBy: "test.test@test.com",
    updatedDt: fn!datetime(2024, 9, 30, 3, 54, 20, 0),
    destTicketTypeId: 268,
    uuid: "6c092428-7b84-465b-8131-de5d2f83477e"
    )
    },
    local!actualKeys: index(local!data,"autofillDestFieldName",null),
    local!dictionaryValues:index(local!actualData,local!actualKeys,null),
    createdictionary(
    touniformstring(local!actualKeys),
    touniformstring(local!dictionaryValues)
    )
    )

Reply
  • 0
    Certified Associate Developer
    in reply to Klaus34

    Hi Klaus, I copied your code and tried, I hope this is my correct understanding for your requirement.

    a!localVariables(
    local!actualData: {
    a!map(
    standardFieldId: 277,
    categoryId: 350,
    ticketTypeId: 439,
    providerTypeLookupRefId: 42,
    assignee: fn!touser("egbeyong@test.com"),
    slaId: 379,
    priorityLookupRefId: 30,
    statusLookupRefId: 39,
    subStatusLookupRefId: 49,
    description: "Description Auto fill",
    submitterLookupRefId: 8,
    dueDate: fn!date(2024, 9, 25),
    isActive: true,
    createdBy: fn!touser("test.test@test.com"),
    createdDt: fn!datetime(2024, 9, 25, 10, 26, 55, 0),
    updatedBy: fn!touser("test.test@test.com"),
    updatedDt: fn!datetime(2024, 9, 25, 10, 27, 2, 0),
    ticketTypeName: "Provider Data Edit",
    derivedTicketId: "PRVDATAEDIT-277",
    dueDateSpecial: fn!date(2024, 9, 25),
    daysLeft: - 5,
    code:"Test",
    summary:"Testwer"
    )
    },
    local!data: {
    a!map(
    escalationFieldId: 14069,
    escalationPathwayId: 387,
    isRequired: true,
    visibilityStatusLookupRefId: fn!tointeger(null),
    autofillSourceFieldName: "description",
    autofillDestFieldName: "code",
    bigQueryRule: fn!tointeger(null),
    automationTypeLookupId: 40,
    isVisible: true,
    isActive: true,
    createdBy: "test.test@test.com",
    createdDt: fn!datetime(2024, 9, 30, 3, 54, 20, 0),
    updatedBy: "test.test@test.com",
    updatedDt: fn!datetime(2024, 9, 30, 3, 54, 20, 0),
    destTicketTypeId: 268,
    uuid: "f03b6999-c073-43b7-a584-04aa5e988710"
    ),
    a!map(
    escalationFieldId: 14034,
    escalationPathwayId: 387,
    isRequired: true,
    visibilityStatusLookupRefId: fn!tointeger(null),
    autofillSourceFieldName: "description",
    autofillDestFieldName: "description",
    bigQueryRule: fn!tointeger(null),
    automationTypeLookupId: 40,
    isVisible: true,
    isActive: true,
    createdBy: "test.test@test.com",
    createdDt: fn!datetime(2024, 9, 30, 3, 54, 20, 0),
    updatedBy: "test.test@test.com",
    updatedDt: fn!datetime(2024, 9, 30, 3, 54, 20, 0),
    destTicketTypeId: 268,
    uuid: "0038a9e9-e0d3-4c36-8b50-eb97ecbbf39e"
    ),
    a!map(
    escalationFieldId: 14032,
    escalationPathwayId: 387,
    isRequired: true,
    visibilityStatusLookupRefId: fn!tointeger(null),
    autofillSourceFieldName: "summary",
    autofillDestFieldName: "summary",
    bigQueryRule: fn!tointeger(null),
    automationTypeLookupId: 40,
    isVisible: true,
    isActive: true,
    createdBy: "test.test@test.com",
    createdDt: fn!datetime(2024, 9, 30, 3, 54, 20, 0),
    updatedBy: "test.test@test.com",
    updatedDt: fn!datetime(2024, 9, 30, 3, 54, 20, 0),
    destTicketTypeId: 268,
    uuid: "6c092428-7b84-465b-8131-de5d2f83477e"
    )
    },
    local!actualKeys: index(local!data,"autofillDestFieldName",null),
    local!dictionaryValues:index(local!actualData,local!actualKeys,null),
    createdictionary(
    touniformstring(local!actualKeys),
    touniformstring(local!dictionaryValues)
    )
    )

Children
No Data