Navigation using LINK FIELD and WITH not working

I have a Document Link -->

I have a column layout with image field and document image and a dynamic link with a label and a value saved into action_txt local variable as below.

 a!columnLayout(
                a!imageField(
                  images: {
                    a!documentImage(
                      document: cons!POC_IMG,
                      link: a!dynamicLink(
                        label: "CLICK_HERE",
                        value: "CLICK_HERE",
                        saveInto: {
                          local!action_txt
                        }
                      )
                    ),
                        
                  },
                  size: local!imageSize
                )

I then call a WITH function which has an IF statement in it wherein if the value of the variable action_txt is CLICK_HERE, it should call another rule which is a report with a grid layout. But the below does not seem to work for some reason. The  ON CLICK does not invoke the report. Any idea why?

with(
      local!masterDatasubset:if(local!action_txt="CLICK_HERE",rule!POC_PrintReport(),{}),
 

  Discussion posts and replies are publicly visible

Parents Reply Children
  • 0
    Certified Lead Developer
    in reply to aneeshv713

    Then you probably need to try the second option I suggested.

    Edit: please try the structure I've prepared here - it's your original code as above but with some unnecessary stuff commented out (like the entire with() statement since it's unnecessary at the moment), and the report rule called appropriately inside the formLayout contents.

    Please also note that rule!POC_Report will need to only contain elements that are allowed to be nested within the contents of a!formLayout, such as a section, box layout, or individual component or array of components.  If, for example, the rule contains its own a!formLayout for some reason, i would expect you'll get an error when trying my code.

    load(
      local!test,
      local!action_txt,
      local!action,
      local!imageSize: "FIT",
      /*local!masterDatasubset,*/
      local!pagingInfo: a!pagingInfo(
        startIndex: 1,
        batchSize: 20
      ),
      
      /*with(*/
        /*local!masterDatasubset: if(*/
          /*local!action_txt="CLICK_HERE",*/
          /*rule!POC_Report(),*/
          /*{}*/
        /*),*/
      
        a!formLayout(
          contents: {
            a!imageField(
              images: {
                a!documentImage(
                  document: cons!POC_IMG,
                  link: a!submitLink(
                    label: "CLICK_HERE",
                    value: "CLICK_HERE",
                    saveInto: {
                      local!action_txt
                    }
                  )
                )
              },
              size: local!imageSize
            ),
            
            if(
              local!action_txt="CLICK_HERE",
              rule!POC_Report(),
              {}
            )
            
          }
        )
      /*)*/
    )