Custom Action - how to create a custom action to view records in one table based on a related record in another table

Custom Action - how to create a custom action to view records in one table based on a related record in another table

I have two tables.  One is called “campaigns”.  The other is called “tactics”.  You have multiple tactics for each campaign.  The “tactics” table is linked to the "campaigns" table by the lookup field “campaign_name” in the tactics table.  Each campaign is treated as a separate record in the "campaign" table.  

I know I could create a subform in the "campaigns" form that would allow you to enter tactics within the campaigns form, and the 1 to many relationship would be created automatically, displaying the associated tactics. 

However, I don’t want to create a subform.  I want to place a custom action button in each record (row) in the "campaigns" report, that when clicked displays a report of all the tactics linked to that campaign by the lookup field "campaign_name." with that campaign record. 

I've created the custom action button, but so far I haven’t been able to write the correct code that will filter the records in the tactics report based on the lookup field (campaign_name) in the "tactics" table.  A report displays, but it is of all records in the "tactics" table, not just those associated with the selected campaign record in the "campaigns" table.  In effect, I want to fetch the tactics records for each campaign by clicking a custom action button, placed in the row (record) of the "campaigns" report, displaying a "tactics" report for that campaign.

This is the code that generates the linked report that isn't filtered:

void viewtactics(int tactics_obj)
{
    openUrl("#Report:Tactics_Report?campaign=","same window");
}

See attached jpgs

I have looked just about everywhere for advice on writing this code, but haven't seen anyone else with this particular issue.  Would love some help and advice, as I want to be able to do this for more than one table and related table. 

    Zoho Developer Community






                              Zoho Desk Resources

                              • Desk Community Learning Series


                              • Digest


                              • Functions


                              • Meetups


                              • Kbase


                              • Resources


                              • Glossary


                              • Desk Marketplace


                              • MVP Corner


                              • Word of the Day



                                  Zoho Marketing Automation


                                          Manage your brands on social media



                                                Zoho TeamInbox Resources

                                                  Zoho DataPrep Resources



                                                    Zoho CRM Plus Resources

                                                      Zoho Books Resources


                                                        Zoho Subscriptions Resources

                                                          Zoho Projects Resources


                                                            Zoho Sprints Resources


                                                              Qntrl Resources


                                                                Zoho Creator Resources


                                                                  Zoho WorkDrive Resources



                                                                    Zoho Campaigns Resources

                                                                      Zoho CRM Resources

                                                                      • CRM Community Learning Series

                                                                        CRM Community Learning Series


                                                                      • Tips

                                                                        Tips

                                                                      • Functions

                                                                        Functions

                                                                      • Meetups

                                                                        Meetups

                                                                      • Kbase

                                                                        Kbase

                                                                      • Resources

                                                                        Resources

                                                                      • Digest

                                                                        Digest

                                                                      • CRM Marketplace

                                                                        CRM Marketplace

                                                                      • MVP Corner

                                                                        MVP Corner

                                                                      





                                                                      




                                                                          Design. Discuss. Deliver.

                                                                          Create visually engaging stories with Zoho Show.

                                                                          Get Started Now