Script activity failed: Argument {0} is null or empty. Parameter name: paraKey

Francisco Dominguez 386 Reputation points
2022-03-17T12:00:49.327+00:00

Hi,

Please see this topic for reference: https://learn.microsoft.com/en-us/answers/questions/763892/script-activity-failed-argument-0-is-null-or-empty.html

I'm getting the same error in the Script1 activity in the following JSON:

{  
                "name": "For each status change",  
                "type": "ForEach",  
                "dependsOn": [  
                    {  
                        "activity": "Filter status changes",  
                        "dependencyConditions": [  
                            "Succeeded"  
                        ]  
                    }  
                ],  
                "userProperties": [],  
                "typeProperties": {  
                    "items": {  
                        "value": "@activity('Filter status changes').output.Value",  
                        "type": "Expression"  
                    },  
                    "activities": [  
                        {  
                            "name": "Insert changelog",  
                            "type": "Script",  
                            "dependsOn": [],  
                            "policy": {  
                                "timeout": "0.00:02:00",  
                                "retry": 0,  
                                "retryIntervalInSeconds": 30,  
                                "secureOutput": false,  
                                "secureInput": false  
                            },  
                            "userProperties": [],  
                            "linkedServiceName": {  
                                "referenceName": "DatawithoutDV",  
                                "type": "LinkedServiceReference"  
                            },  
                            "typeProperties": {  
                                "scripts": [  
                                    {  
                                        "type": "Query",  
                                        "text": {  
                                            "value": "@concat('DELETE FROM IssueChangelog WHERE changelogId=', item().id, ' ',\n    'INSERT INTO IssueChangelog (changelogId, issueId, changeDate, type, fromStatus, toStatus, diffToPreviousStatus) VALUES (',\n    item().id, ', ',\n    pipeline().parameters.issueId, ', ',\n    '''', substring(item().created, 0, 22), ''', ',\n    '''', item().items[0].field, ''', ',\n    '''', item().items[0].fromString, ''', ',\n    '''', item().items[0].toString, ''', ',\n    string(0), ')'\n)",  
                                            "type": "Expression"  
                                        }  
                                    }  
                                ]  
                            }  
                        },  
                        {  
                            "name": "Script1",  
                            "type": "Script",  
                            "dependsOn": [  
                                {  
                                    "activity": "Insert changelog",  
                                    "dependencyConditions": [  
                                        "Succeeded"  
                                    ]  
                                }  
                            ],  
                            "policy": {  
                                "timeout": "7.00:00:00",  
                                "retry": 0,  
                                "retryIntervalInSeconds": 30,  
                                "secureOutput": false,  
                                "secureInput": false  
                            },  
                            "userProperties": [],  
                            "linkedServiceName": {  
                                "referenceName": "nucleooDatawithoutDV",  
                                "type": "LinkedServiceReference"  
                            },  
                            "typeProperties": {  
                                "scripts": [  
                                    {  
                                        "type": "Query",  
                                        "text": {  
                                            "value": "@concat('SELECT MAX(changeDate) FROM IssueChangelog WHERE issueId=', pipeline().parameters.issueId)",  
                                            "type": "Expression"  
                                        }  
                                    }  
                                ]  
                            }  
                        }  
                    ]  
                }  
            }  

pipeline().parameters.issueId has a value and its valid. If I run the same query in my Azure Data Studio, I obtain the expected result.

Thanks in advance.

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
9,528 questions
0 comments No comments
{count} votes

Accepted answer
  1. KranthiPakala-MSFT 46,422 Reputation points Microsoft Employee
    2022-03-18T23:50:18.463+00:00

    Hello @Francisco Dominguez ,

    Thanks for the question and using MS Q&A platform.

    Just to clarify the problem - you are seeing above error message while trying to use the script activity. From the reference link, it seems like you have received this error message due to the query formation, when you changed query from A to B it got resolved in the reference link. But again, you have noticed same error message when using Script activity for another query. Please correct if my understanding is not correct.

    By looking at the query I don't see anything wrong, except for the second query where you are selecting the max change date without giving a alias column name to it. Please try providing a column alias name to the return value in your second query for selecting Max change date which should help resolve the issue.

    Could you please try below and see if that helps to resolve the issue?

    @concat('SELECT MAX(changeDate) as  MaxChangeDate FROM IssueChangelog WHERE issueId=', pipeline().parameters.issueId)  
    

    I did try to reproduce the problem and was able to find that not giving a column alias name for the return values generates the above error message. For more clarification, please see below GIF.

    184761-scriptactivityerror.gif

    Please let us know if that helps to resolve the issue. In the meantime, I will reach out to respective product owners to notify this issue and will see if we can add this information in public documentation as a note.

    Hope this helps. Do let us know how it goes.

    ------------------------------

    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
    • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators
    6 people found this answer helpful.

0 additional answers

Sort by: Most helpful