Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

PowerShell and JIRA

$
0
0

Hi there

I'm new to PowerShell and i have been tasked to edit a PowerShell script.

This powershell script as a function called create_jira_content which as $issueType value hard-coded to only deal with one type of JIRA issue called "Live Request".

We have a couple more type of issue types in JIRA which i would like to pass as parameter to $issueType.

Each of these other issue type have their own pre-defined set up $body values

I have got the $body values for each of these other issue types i'm talking about by calling Invoke-RestMethod but i'm not sure how i can pass this various $body values as parameter into this function so that the line in the function looks something like this

[String] $issueType = $IssueTypes;

Do i need to create seperate modules for each Issue Types and pass the modules as an array of parameters?

I really don't know so please could one of you guide me on this.

 

function create_jira_content()

{

    param($Stream,$Transactions,$SharedLibs,$WConfig,$IConfig,$SettingsRequired,$settings,$buildType)

    [String] $projectKey = $Project;

    [String] $issueType = "Live Request";

    [String] $summary = $Summary;

    [String] $product = $Product;

    [String] $brSubproduct = $SubProduct;

    [String] $description = $settings + '\n\n' + $buildType;

    [String] $stream = $Stream; 

    [String] $iConfigs = $IConfig; 

    [String] $wConfigs = $WConfig;

    [String] $bSettings = $SettingsRequired; 

    [String] $transaction = $Transactions

    [String] $sharedLib = $SharedLibs

    [String] $db = "No"

    [String] $body = '{"fields":{

                        "project":{"key":"'+$projectKey+'"},

                        "issuetype":{"name": "'+$issueType+'"},

                        "summary":"'+$summary+'",

                        "description":"'+$description+'",

                        "customfield_10301":[{"value":"' + $product + '"}],

                        "customfield_12021":[{"value":"' + $brSubproduct +'"}], 

                        "customfield_12210":"' + $sharedLib + '", 

                        "customfield_12020":{"value":"Other"},

                        "customfield_14500":{"value":"' + $iConfigs + '"},

                        "customfield_12014":{"value":"' + $b365Settings + '"},

                        "customfield_12018":{"value":"No"},

                        "customfield_12015":{"value":"' + $db + '"},

                        "customfield_12017":{"value":"No"},

                        "customfield_10010":"'+$transaction+'",

                        "customfield_12012":{"value":"' + $wConfigs + '"},

                        "customfield_12013":{"value":"No"},

                        "customfield_11601":{"value":"Other"},

                        "customfield_11933":"' + $stream + '"

                        }}';


    ,$body

}


 


Viewing all articles
Browse latest Browse all 6937

Trending Articles