4

Can anyone please advice how to access/read system variables in Script Component (e.g I want to package name from this variable System::PackageName in Script Component)

1

1 Answer 1

12

In the Script Task Editor, provide the variable names you want to access (for example System::PackageName) in the ReadOnlyVariables field.

From the script, in the C# example, use this:

public void Main()
    {
        bool fireAgain = true;

        // Read the variable
        String PackageName = (String)Dts.Variables["System::PackageName"].Value;

        // Post the value to progress results
        Dts.Events.FireInformation(3, "Package name:", PackageName, "", 0, ref fireAgain);

        Dts.TaskResult = (int)ScriptResults.Success;
    }

The results:

Package named Package

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.