We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

How to pass the object values through script include for the flow designer servicenow

Nayan Mule
Tera Contributor

I have created one action in which I have an input as array object. In that array object, I have another object.

NayanMule_0-1715332034130.png

I want to pass the value through script include. But, everytime the value is returning as [object object]  in the logs.

 createInvoiceLine: function(invoiceLinesInput) {
        var invoicelines = [];
        if (typeof(invoiceLinesInput) == 'string') {

            invoiceLinesInput = JSON.parse(invoiceLinesInput);
        }
        for (var i = 0; i < invoiceLinesInput.length; i++) {

            var invoiceLineJson = {}; /
if (invoiceLinesInput[i]["account"]['code']) {
                invoiceLineJson["account"] = {
                    "code": invoiceLinesInput[i]["account"]['code']
                };
            }
 invoicelines[i] = invoiceLineJson;
        }
 return invoicelines;
    },
 
 
this is the code I am using, but it is  not returining proper value passed through an action - [Object object]
 
Any help will be appreciated 
thanks & regards
Nayan
1 REPLY 1