Not appending the data inside the grid

Hi Team, I am facing issue while trying to append the data to rule input , I have editable gird with multiple components with add and remove option using same component i.e dynamic link, so I am trying to update/add some data based on the item getting added. Its working 1st time , if i change the plan, scenario they are like button to navigate. i try adding it to different plan its not appending  it.

only 1st time added data is reflecting.

localVariables(
a!localVariables(
  local!customDataforNewPlan: {
    a!map(
      prcRequestId: 1,
      wmsRequestId: 101,
      annualfee: 1000,
      minimumfee: 0,
      sequence: 1,
      amount: 500,
      createdby: "user1",
      createdon: now(),
      updatedby: "user1",
      updatedon: now(),
      isactive: true()
    ),
    a!map(
      prcRequestId: 2,
      wmsRequestId: 102,
      annualfee: 2000,
      minimumfee: 0,
      sequence: 2,
      amount: 1000,
      createdby: "user2",
      createdon: now(),
      updatedby: "user2",
      updatedon: now(),
      isactive: true()
    ),
    a!map(
      prcRequestId: 3,
      wmsRequestId: 103,
      annualfee: 3000,
      minimumfee: 0,
      sequence: 3,
      amount: 1500,
      createdby: "user3",
      createdon: now(),
      updatedby: "user3",
      updatedon: now(),
      isactive: true()
    )
  },
 

  
  
  
  a!richTextDisplayField(
                            value: {
                              a!richTextImage(
                                image: a!documentImage(
                                  document: a!iconIndicator(
                                    icon: if(
                                      a!isNullOrEmpty(
                                        filter(
                                          rule!PRC_filterExistingClientExtServices,
                                          ri!services,
                                          ri!selectedScenario['recordType!{94f6f945-ec9c-4178-8b3f-684a5547bb00}PRC Scenarios.fields.{ad9e991c-6487-437f-8665-fe15a96eba42}prcScenarioId'],
                                          ri!selectedPlan['recordType!{3b41856e-be2b-486e-b0f7-09436ce2d07e}PRC Plan.fields.{4903a64b-b0f8-4ddb-98d1-00bcc0e648d1}prcPlanId'],
                                          fv!item['recordType!{5e7d58bd-6c85-45db-80c6-576662ae83e4}WMS REF SERVICES EXTENTION.fields.{f118cef5-0b82-4443-a1cd-b06816f1ca22}extentionId']
                                        )
                                      ),
                                      "ADD",
                                      "REMOVE"
                                    )
                                  ),
                                  altText: "Remove",
                                  caption: "Remove",
                                  link: a!dynamicLink(
                                    value: fv!item,
                                    saveInto: {
                                      a!save(
                                        ri!currentServices,
                                        if(
                                          a!isNullOrEmpty(
                                            filter(
                                              rule!PRC_filterExistingClientExtServices,
                                              ri!services,
                                              ri!selectedScenario['recordType!{94f6f945-ec9c-4178-8b3f-684a5547bb00}PRC Scenarios.fields.{ad9e991c-6487-437f-8665-fe15a96eba42}prcScenarioId'],
                                              ri!selectedPlan['recordType!{3b41856e-be2b-486e-b0f7-09436ce2d07e}PRC Plan.fields.{4903a64b-b0f8-4ddb-98d1-00bcc0e648d1}prcPlanId'],
                                              fv!item['recordType!{5e7d58bd-6c85-45db-80c6-576662ae83e4}WMS REF SERVICES EXTENTION.fields.{f118cef5-0b82-4443-a1cd-b06816f1ca22}extentionId']
                                            )
                                          ),
                                          {
                                            append(
                                              ri!currentServices,
                                              'recordType!{471f50a7-6d9a-4e1b-a1ae-4b84239a4583}PRC Services'(
                                                'recordType!{471f50a7-6d9a-4e1b-a1ae-4b84239a4583}PRC Services.fields.{41821eb1-fd97-4969-85d8-b43cef17bf13}prcRequestId': ri!selectedPlan['recordType!{3b41856e-be2b-486e-b0f7-09436ce2d07e}PRC Plan.fields.{861ddc1d-cf5b-453a-8ddd-8e656f04518d}prcRequestId'],
                                                'recordType!{471f50a7-6d9a-4e1b-a1ae-4b84239a4583}PRC Services.fields.{fae848cf-eff7-4f11-80b3-ff2edb24fb48}wmsRequestId': ri!selectedPlan['recordType!{3b41856e-be2b-486e-b0f7-09436ce2d07e}PRC Plan.fields.{522173d3-80f7-456d-8aff-6ec551adda4d}wmsRequestId'],
                                                'recordType!{471f50a7-6d9a-4e1b-a1ae-4b84239a4583}PRC Services.fields.{f45647c7-c581-4190-b365-b0db2dfaf6ad}prcPlanId': ri!selectedPlan['recordType!{3b41856e-be2b-486e-b0f7-09436ce2d07e}PRC Plan.fields.{4903a64b-b0f8-4ddb-98d1-00bcc0e648d1}prcPlanId'],
                                                'recordType!{471f50a7-6d9a-4e1b-a1ae-4b84239a4583}PRC Services.fields.{9ed411b8-0ef8-43f4-8279-7cb0d1906edf}planname': ri!selectedPlan['recordType!{3b41856e-be2b-486e-b0f7-09436ce2d07e}PRC Plan.fields.{4555524c-a24a-4a51-8cf0-d61a575a1b23}planName'],
                                                'recordType!{471f50a7-6d9a-4e1b-a1ae-4b84239a4583}PRC Services.fields.{15ae6ce2-ff70-48b8-ac87-a04a0bb310b9}serviceExtId': fv!item['recordType!{5e7d58bd-6c85-45db-80c6-576662ae83e4}WMS REF SERVICES EXTENTION.fields.{f118cef5-0b82-4443-a1cd-b06816f1ca22}extentionId'],
                                                'recordType!{471f50a7-6d9a-4e1b-a1ae-4b84239a4583}PRC Services.fields.{ac488d50-2dc9-4ea4-912c-132dbb00d106}serviceName': fv!item['recordType!{5e7d58bd-6c85-45db-80c6-576662ae83e4}WMS REF SERVICES EXTENTION.fields.{b2860a9f-6d40-48bf-aa08-ee2a53919e8f}serviceName'],
                                                'recordType!{471f50a7-6d9a-4e1b-a1ae-4b84239a4583}PRC Services.fields.{750f07da-7fcc-4536-baf7-2f1c4195a07d}pricingGuideline': fv!item['recordType!{5e7d58bd-6c85-45db-80c6-576662ae83e4}WMS REF SERVICES EXTENTION.fields.{de298c0d-e21d-452f-9409-8cb8b16035fc}pricingGuideline'],
                                                'recordType!{471f50a7-6d9a-4e1b-a1ae-4b84239a4583}PRC Services.fields.{12fef09a-749d-46f1-b922-2f67b6d6ecc9}billCode': fv!item['recordType!{5e7d58bd-6c85-45db-80c6-576662ae83e4}WMS REF SERVICES EXTENTION.fields.{f1ef67e3-5b8a-40a3-9bb9-2871391f05de}billCode'],
                                                'recordType!{471f50a7-6d9a-4e1b-a1ae-4b84239a4583}PRC Services.fields.{898df48b-4fb4-4f70-b804-f127fdca4e12}segment': fv!item['recordType!{5e7d58bd-6c85-45db-80c6-576662ae83e4}WMS REF SERVICES EXTENTION.fields.{89e995c9-29a4-49f2-854a-bbde7c3f190a}segment'],
                                                'recordType!{471f50a7-6d9a-4e1b-a1ae-4b84239a4583}PRC Services.fields.{73eb5013-3fcc-412b-882d-f1f44d11b5a9}serviceType': fv!item['recordType!{5e7d58bd-6c85-45db-80c6-576662ae83e4}WMS REF SERVICES EXTENTION.fields.{0d0efb95-3460-4d8d-b19c-e282d2f56ea9}serviceType'],
                                                'recordType!{471f50a7-6d9a-4e1b-a1ae-4b84239a4583}PRC Services.fields.{876f8d8c-4777-454c-964d-60355b779886}serviceClassification': fv!item['recordType!{5e7d58bd-6c85-45db-80c6-576662ae83e4}WMS REF SERVICES EXTENTION.fields.{d60e4f5f-710f-4a17-a7a7-7fe27e655c4f}serviceClassification'],
                                                'recordType!{471f50a7-6d9a-4e1b-a1ae-4b84239a4583}PRC Services.fields.{9d90c083-771f-4411-8e88-ea863ce3e979}iteration': ri!activeTab,
                                                'recordType!{471f50a7-6d9a-4e1b-a1ae-4b84239a4583}PRC Services.fields.{415a97ac-e4e0-49b9-bcc7-f03369669e84}quantity': if(
                                                  rule!APN_replaceNull(
                                                    nullableValue: fv!item['recordType!{5e7d58bd-6c85-45db-80c6-576662ae83e4}WMS REF SERVICES EXTENTION.fields.{38bcfcc7-3572-459a-8fe3-6210b4ae3676}quantityNeeded'],
                                                    replacementValue: false()
                                                  ),
                                                  cons!WMS_INT_ONE,
                                                  tointeger(null())
                                                ),
                                                'recordType!{471f50a7-6d9a-4e1b-a1ae-4b84239a4583}PRC Services.fields.{6190b998-ccee-4f07-8f81-5cf1c816b7d0}exceptionapproved': if(
                                                  fv!item['recordType!{5e7d58bd-6c85-45db-80c6-576662ae83e4}WMS REF SERVICES EXTENTION.fields.{d60e4f5f-710f-4a17-a7a7-7fe27e655c4f}serviceClassification'] = cons!WMS_REF_ID_SERVICE_CLASSIFICATION_EXCEPTIONAL_SERVICES,
                                                  false(),
                                                  null()
                                                ),
                                                'recordType!{471f50a7-6d9a-4e1b-a1ae-4b84239a4583}PRC Services.fields.{bd7fa2f1-f7c2-4b44-8c63-21828512fca9}createdBy': loggedInUser(),
                                                'recordType!{471f50a7-6d9a-4e1b-a1ae-4b84239a4583}PRC Services.fields.{df733375-25de-4d4a-968e-637ad31a2640}createdOn': now(),
                                                'recordType!{471f50a7-6d9a-4e1b-a1ae-4b84239a4583}PRC Services.fields.{9cbaed7f-c755-4f8e-960a-70085d4793eb}updatedBy': loggedInUser(),
                                                'recordType!{471f50a7-6d9a-4e1b-a1ae-4b84239a4583}PRC Services.fields.{5bf5e1ee-d88a-4206-ad99-300e1c83f509}updatedOn': now(),
                                                'recordType!{471f50a7-6d9a-4e1b-a1ae-4b84239a4583}PRC Services.fields.{ed5331c1-bf65-4b23-b9a8-9e793c9d522d}isActive': true(),
                                                'recordType!{471f50a7-6d9a-4e1b-a1ae-4b84239a4583}PRC Services.fields.{e9d930ec-572d-4bf6-9c82-0c8ec4dd0612}scenarioId': ri!selectedScenario['recordType!{94f6f945-ec9c-4178-8b3f-684a5547bb00}PRC Scenarios.fields.{ad9e991c-6487-437f-8665-fe15a96eba42}prcScenarioId'],
                                                'recordType!{471f50a7-6d9a-4e1b-a1ae-4b84239a4583}PRC Services.fields.{afb760b2-5770-4283-b434-26690c246bf4}scenarioName': ri!selectedScenario['recordType!{94f6f945-ec9c-4178-8b3f-684a5547bb00}PRC Scenarios.fields.{eb127935-e8d9-401a-af9a-d55fa619e0d4}scenarioName'],
                                                'recordType!{471f50a7-6d9a-4e1b-a1ae-4b84239a4583}PRC Services.fields.{3cc2676f-26f4-493e-a955-438b15219235}serviceCategory': cons!PRC_REF_ID_SERVICE_CATEGORY_EXISTING_CLIENT_STANDARD
                                              )
                                            )
                                          },
                                          {
                                            remove(
                                              ri!currentServices,
                                              wherecontains(
                                                filter(
                                                  rule!PRC_filterExistingClientExtServices,
                                                  ri!services,
                                                  ri!selectedScenario['recordType!{94f6f945-ec9c-4178-8b3f-684a5547bb00}PRC Scenarios.fields.{ad9e991c-6487-437f-8665-fe15a96eba42}prcScenarioId'],
                                                  ri!selectedPlan['recordType!{3b41856e-be2b-486e-b0f7-09436ce2d07e}PRC Plan.fields.{4903a64b-b0f8-4ddb-98d1-00bcc0e648d1}prcPlanId'],
                                                  fv!item['recordType!{5e7d58bd-6c85-45db-80c6-576662ae83e4}WMS REF SERVICES EXTENTION.fields.{f118cef5-0b82-4443-a1cd-b06816f1ca22}extentionId']
                                                ),
                                                ri!currentServices
                                              )
                                            )
                                          }
                                        )
                                      ),
                                      a!save(
                                        local!feeDetailsNew,
                                        if(
                                          a!isNullOrEmpty(
                                            a!forEach(
                                              items: ri!feeDetailsProspect,
                                              expression: if(
                                                and(
                                                  fv!item['recordType!{f6895dd9-7b01-4146-a52e-be727fef79d3}PRC Vmap Service Fee.fields.{6e4fe629-03b7-49fe-8d52-f541257e3ca5}planId'] = ri!selectedPlan['recordType!{3b41856e-be2b-486e-b0f7-09436ce2d07e}PRC Plan.fields.{48af5ea7-53fc-4a62-a14e-74face5ff62a}planId'],
                                                  fv!item['recordType!{f6895dd9-7b01-4146-a52e-be727fef79d3}PRC Vmap Service Fee.fields.{30de7239-941c-401f-ad56-2672421eba71}scenarioId'] = ri!selectedScenario['recordType!{94f6f945-ec9c-4178-8b3f-684a5547bb00}PRC Scenarios.fields.{ad9e991c-6487-437f-8665-fe15a96eba42}prcScenarioId'],
                                                  fv!item['recordType!{f6895dd9-7b01-4146-a52e-be727fef79d3}PRC Vmap Service Fee.fields.{7e014768-277f-4844-a8d0-7c6baeccf934}iteration'] = ri!activeTab,
                                                  contains({27, 75, 251, 261, 271}, tointeger(fv!item['recordType!{f6895dd9-7b01-4146-a52e-be727fef79d3}PRC Vmap Service Fee.fields.{4a8a03ee-98f5-4712-8135-4c235968e033}serviceExId']))
                                                ),
                                                fv!item,
                                                {}
                                              )
                                            )
                                          ),
                                          append(
                                            local!feeDetailsNew,
                                            a!forEach(
                                              items: ri!currentServices,
                                              expression: a!localVariables(
                                                local!service: fv!item,
                                                if(
                                                  contains({27, 75, 251, 261, 271},
                                                  tointeger(index(local!service, 'recordType!{471f50a7-6d9a-4e1b-a1ae-4b84239a4583}PRC Services.fields.{15ae6ce2-ff70-48b8-ac87-a04a0bb310b9}serviceExtId', null))
                                                  ),
                                                  a!forEach(
                                                    items:local!feeDetailscustomPlan,
                                                    expression: a!update(
                                                      data: fv!item,
                                                      index:{ 'recordType!{f6895dd9-7b01-4146-a52e-be727fef79d3}PRC Vmap Service Fee.fields.{4a8a03ee-98f5-4712-8135-4c235968e033}serviceExId',
                                                        'recordType!{f6895dd9-7b01-4146-a52e-be727fef79d3}PRC Vmap Service Fee.fields.{7e014768-277f-4844-a8d0-7c6baeccf934}iteration',
                                                        'recordType!{f6895dd9-7b01-4146-a52e-be727fef79d3}PRC Vmap Service Fee.fields.{6e4fe629-03b7-49fe-8d52-f541257e3ca5}planId',
                                                        'recordType!{f6895dd9-7b01-4146-a52e-be727fef79d3}PRC Vmap Service Fee.fields.{30de7239-941c-401f-ad56-2672421eba71}scenarioId'},
                                                      value: {index(local!service, 'recordType!{471f50a7-6d9a-4e1b-a1ae-4b84239a4583}PRC Services.fields.{15ae6ce2-ff70-48b8-ac87-a04a0bb310b9}serviceExtId', null),
                                                      ri!activeTab
                                                      ,ri!selectedPlan['recordType!{3b41856e-be2b-486e-b0f7-09436ce2d07e}PRC Plan.fields.{4903a64b-b0f8-4ddb-98d1-00bcc0e648d1}prcPlanId'],
                                                      ri!selectedScenario['recordType!{94f6f945-ec9c-4178-8b3f-684a5547bb00}PRC Scenarios.fields.{ad9e991c-6487-437f-8665-fe15a96eba42}prcScenarioId']}
                                                    )
                                                  ),
                                                  {}
                                                )
                                              )
                                            )
                                          ),
                                          /* Else: remove matching fee details */
                                          reject(
                                            rule!PRC_rejectFeeDetails,
                                            ri!feeDetailsNew,
                                            
                                            ri!selectedPlan,
                                            ri!selectedScenario,
                                            ri!activeTab
                                            
                                          )
                                         
                                        
                                      )
                                      ),
                                      
                                      a!save(ri!services, ri!currentServices),
                                      a!save(ri!feeDetailsNew, local!feeDetailsNew),
                                      a!save(ri!feeDetailsProspect,ri!feeDetailsNew)
                                    },
                                    
                                  )
                                ),
                                showWhen: not(
                                  rule!APN_replaceNull(
                                    nullableValue: ri!readOnly,
                                    replacementValue: false()
                                  )
                                )
                              )
                            },
                            align: "CENTER"
                          )

The ri!currentservices is used as data for the editable grid , whichever service is added through this dynamic link will populate in another grid . Anyone help me finding the issue .

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Looks like grid’s data variable is not properly reset or updated when switching plans or scenarios, so the append action only works the first time.
    Try to reset or reinitialize the grid’s data variable (ri!currentServices) whenever the plan or scenario changes, and ensure that your saveInto expressions correctly update both local and rule input variables to refresh the grid data on each add or remove action.

Reply
  • 0
    Certified Lead Developer

    Looks like grid’s data variable is not properly reset or updated when switching plans or scenarios, so the append action only works the first time.
    Try to reset or reinitialize the grid’s data variable (ri!currentServices) whenever the plan or scenario changes, and ensure that your saveInto expressions correctly update both local and rule input variables to refresh the grid data on each add or remove action.

Children
No Data