How to get related fields of another record while creating a transaction saved search?

For an example, while creating an invoice search the required columns includes some fields in
customer record. The code shows, how to join customer record fields to invoice search.

var mySearch = search.create({
                      type: "invoice",
                      filters:
                          [
                              ["trandate","before","startofthismonth"],
                              "AND",
                              ["mainline","is","T"],
                              "AND",
                              ["status","anyof","CustInvc:A"],
                              "AND",
                              ["daysoverdue","greaterthan","0"]
                          ],
                     columns:
                         [
                             search.createColumn({name: "tranid", label: "Document    Number"}),
                             search.createColumn({name: "entity", label: "Name"}),
                             search.createColumn({
                                 name: "salesrep",
                                 join: "customer",
                                 label: "Sales Rep"
                             }),
                             search.createColumn({name: "amount", label: "Amount"}),
                             search.createColumn({
                                 name: "email",
                                 join: "customer",
                                 label: "Email"
                             }),
                             search.createColumn({
                                 name: "daysoverdue",
                                 join: "customer",
                                 label: "Days Overdue"
                             })
                         ]
                  });

Leave a comment

Your email address will not be published. Required fields are marked *