How do you get result.id and result.recordType to ...
# suitescript
n
How do you get result.id and result.recordType to work with a grouped search?
w
If you can group by internalid and recordtype as well, you can do that. Otherwise, you don't.
n
how would I do that? In the column definitions?
c
make the search in the UI first, then export it. easiest way
👆 1
n
I didn't see a type field when doing a customer search. Because I had a customer search in my code and it returned a "job" recored
c
I think it probably makes more sense if you explain what your search is for, doesn't make much sense at the moment
n
its a customer search that ended up returning a few items that linked to Job Records. So wanted to confirm the type is all
b
what does the code for the search look like
n
Copy code
var customerSearchObj = search.create({
                type: "customer",
                filters:
                    [
                        ["isinactive", "is", "F"],
                        "AND",
                        ["consoldaysoverdue", "greaterthan", "0"]
                    ],
                columns:
                    [
                        search.createColumn({
                            name: "entityid",
                            summary: "GROUP",
                            label: "Name"
                        }),
                        search.createColumn({
                            name: "companyname",
                            summary: "GROUP",
                            label: "companyname"
                        }),
                        search.createColumn({
                            name: "internalid",
                            summary: "GROUP",
                            label: "Name"
                        }),
                        search.createColumn({
                            name: "formulatext",
                            summary: "MIN",
                            sort: search.Sort.DESC,
                            formula: "ROUND(CURRENT_DATE-{usernotes.notedate})",
                            label: "Formula (Text)"
                        }),
                        search.createColumn({
                            name: 'consoldaysoverdue',
                            summary: 'MIN',
                            label: "Days Overdue"
                        }),
                        search.createColumn({
                            name: "formulanumeric",
                            summary: "MIN",
                            formula: "CASE WHEN LOWER({messages.subject}) LIKE '%past due invoices%' THEN ROUND(CURRENT_DATE-{messages.messagedate}) END",
                            label: "Formula (Numeric)"
                        })
                    ]
            });
            customerSearchObj.run().each(function (result) {
here's some of it
b
im not really sure what setup you need to get a project to show up in a customer search
thats not normal
otherwise i dont think you can use
consoldaysoverdue
in an entity search, which has filters for the different entity types
so you may just be stuck doing another search (or maybe query)