Home Analyst Portal

Update Configuration Item from Task

Davin_ClouthierDavin_Clouthier Customer Adept IT Monkey ✭✭
Hello,
Having issues talking to Cireson api from my custom task, to update a custom configuration item. The javascript seems to be the main issue which I included below I am guessing it has something to do with the api I chose to try do this, but that is only a guess developer tools didn't give much besides a internal 500 server error.

Some Background info/code to what i am doing:

I created a custom class management pack to create a configuration item to hold time entry, our corp needed a start, end date, time and notes for each entry. After the class was created a tab area inside of our ServiceRequest.js was created to display this item like so:

I was able to make a fake test entry with powershell by doing:
$class = Get-SCSMClass -id "db967d67-3f45-c6bf-a5d5-8e1fb78945a7" $Properties = @{ TimeRecordID = "{0}" WorkItemID = "SR88297" UserID = "b98f6dac-7d95-1cee-10aa-2d34f5ff2008" StartTime = "2017-01-20T07:00:00.000Z" EndTime = "2017-01-20T09:00:00.000Z" TimeInMinutes = "120" ObjectStatus = 'Active' AssetStatus = "6842782d-3707-20a5-659c-b5d4091e2c49" Notes = "Test dat entry" DisplayName = "Clouthier, Davin (CP - Information Technology)" } New-SCSMObject -Class $class -Property $Properties
This works from powershell but when trying to do the same entry adding from javascript, the entry fails (from the tasks on the right) here is my javascript that I was using to do this (attached)
<div> <b>Sorry for the long drawn out post, I was unsure how to clearly convey my issue without providing a bunch of code. </b><br></div> { name: "Action Log", type: "multipleObjectPicker", PropertyName: "RelatesToConfigItem", ClassId: "db967d67-3f45-c6bf-a5d5-8e1fb78945a7", PropertyToDisplay: { DisplayName: "DisplayName", Notes: "Notes", StartTime: "StartTime", EndTime: "EndTime", TimeInMinutes: "TimeInMinutes" }, SelectableRow: false, SelectProperty: "DisplayName", Disabled: true },

Comments

  • Davin_ClouthierDavin_Clouthier Customer Adept IT Monkey ✭✭
    edited January 2017
    Here is the JSON string that is post'ed from the javascript attached, still not sure why this isn't posting


  • Davin_ClouthierDavin_Clouthier Customer Adept IT Monkey ✭✭
    edited January 2017
    After further recreating this in powershell (im better at powershell then javascript) I realize now I am getting unauthorized when sending this, but my account is an admin on the portal is there different permissions required to be set IIS side or server side to use the api?

    IsMutuallyAuthenticated : False
    Cookies                 : {}
    Headers                 : {Pragma, Cache-Control, Content-Type, Expires...}
    SupportsHeaders         : True
    ContentLength           : 81
    ContentEncoding         : 
    ContentType             : application/json; charset=utf-8
    CharacterSet            : utf-8
    Server                  : Microsoft-IIS/8.5
    LastModified            : 1/26/2017 12:00:08 PM
    StatusCode              : Unauthorized
    StatusDescription       : Unauthorized
    ProtocolVersion         : 1.1
    ResponseUri             : http://myciresonportal/api/v3/Projection/Commit
    Method                  : POST
    IsFromCache             : False

Sign In or Register to comment.