the following script should create a ticket when an onboarding has been submitted in Adaxes:
Import-Module JiraPS
$password = ConvertTo-SecureString "password" -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential ('adaxes@domain.com', $password)
Set-JiraConfigServer 'https://domain.atlassian.net'
New-JiraSession -Credential $credential
#Format datetime
$dateConversionFormat = "yyyy-MM-dd"
$duedate_origin = $Context.TargetObject.Get("adm-CustomAttributeDate1")
$duedate = $duedate_origin.ToString($dateConversionFormat)
$initiator = Get-AdmUser -Filter 'mail -like "%initiator%"'
Try{
$issue = New-JiraIssue -Project "IOO" -IssueType Task -Summary "%param-summary%" -Description "%param-description%" -Labels "Onboarding" -Reporter $initiator.UserPrincipalName
Set-JiraIssue -Issue $issue.Key -Fields @{ duedate = $duedate }
Set-AdmUser "%distinguishedName%" -Add @{"adm-CustomAttributeText20"=$issue.Key} -AdaxesService localhost
$Context.LogMessage("Opening Jira Ticket $issue.Key with summary: %param-summary%", "Information")
}
Catch{
$Context.LogException($_.Exception)
}
Finally{
Remove-JiraSession
}
When running the onboarding process, the following errors appear:
Exception calling "Get" with "1" argument(s): "The 'adm-CustomAttributeDate1' property cannot be found in the cache." Stack trace: at <ScriptBlock>, <No file>: line 16
You cannot call a method on a null-valued expression. Stack trace: at <ScriptBlock>, <No file>: line 17