Write a script that gets all transaction forms tha...
# ask-stanley-ai
a
Write a script that gets all transaction forms that can assigned to the Custom Form field on a purchase order.
c
AI generated answer (using internal Slack threads):
To get all transaction forms that can be assigned to the Custom Form field on a purchase order, you can perform a search on the Transaction record in SuiteScript and group by the
customform
column. This will give you a list of all custom forms that are used in transactions. Here is a sample SuiteScript code snippet that you can use as a starting point:
Copy code
javascript
var search = require('N/search');

function execute() {
    var transactionSearch = search.create({
        type: search.Type.TRANSACTION,
        columns: ['customform']
    });

    var pagedData = transactionSearch.runPaged({pageSize: 1000});

    pagedData.pageRanges.forEach(function(pageRange) {
        var page = pagedData.fetch({index: pageRange.index});
        page.data.forEach(function(result) {
            log.debug({
                title: 'Custom Form',
                details: result.getValue({name: 'customform'})
            });
        });
    });
}

execute();
This script will log the internal ID of each custom form used in a transaction. You can modify this script to suit your needs. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.84745568
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.832680702
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.830132186
Please provide your feedback on this answer.
Thank you for your feedback
a
That gives a list of all forms in use by that type of transaction, but not all forms that exist for it.