Package: django-snow
django-snowdjango-snowis a django app to manage ServiceNow tickets from within a django project.Installationpip install django-snowConfigurationdjango-snowrequires the following settings to be set in your Django settings:SNOW_INSTANCE- The ServiceNow instance where the tickets should be createdSNOW_API_USER- The ServiceNow API UserSNOW_API_PASS- The ServiceNow API User’s PasswordSNOW_ASSIGNMENT_GROUP(Optional) - The group to which the tickets should be assigned.
If this is not provided, each call to create the tickets should be provided with anassignment_groupargument.
See the API documentation for more detailsSNOW_DEFAULT_CHANGE_TYPE(Optional) - Default Change Request Type. If not provided,standardwill considered as the default type.UsageCreationChangeRequestHandler.create_change_requesthas the following parameters and return value:Parameterstitle- The title of the change requestdescription- The description of the change requestassignment_group- The group to which the change request is to be assigned.
This isoptionalifSNOW_ASSIGNMENT_GROUPdjango settings is available, else, it ismandatorypayload(Optional) - The payload for creating the Change Request.ReturnsChangeRequestmodel - The model created from the created Change Order.Examplefromdjango_snow.helpersimportChangeRequestHandlerdefchange_data(self):co_handler=ChangeRequestHandler()change_request=co_handler.create_change_request('Title','Description','assignment_group')UpdatingChangeRequestHandler.update_change_requestmethod signature:Parameterschange_request- TheChangeRequestModelpayload- The payload to pass to the ServiceNow REST API.Examplefromdjango_snow.modelsimportChangeRequestfromdjango_snow.helpersimportChangeRequestHandlerdefchange_data(self):change_request=ChangeRequest.objects.filter(...)co_handler=ChangeRequestHandler()payload={'description':'updated description','state':ChangeRequest.TICKET_STATE_IN_PROGRESS}co_handler.update_change_request(change_request,payload)ClosingChangeRequestHandler.close_change_requesthas the following signature:Parameterschange_request- TheChangeRequestModel representing the Change Order to be closed.Examplefromdjango_snow.modelsimportChangeRequestfromdjango_snow.helpersimportChangeRequestHandlerdefchange_data(self):change_request=ChangeRequest.objects.filter(...)co_handler=ChangeRequestHandler()co_handler.close_change_request(change_request)Closing with errorChangeRequestHandler.close_change_request_with_errormethod signature:Parameterschange_request- TheChangeRequestModel representing the Change Order to be closed with errorpayload- The payload to pass to the ServiceNow REST API.Examplefromdjango_snow.modelsimportChangeRequestfromdjango_snow.helpersimportChangeRequestHandlerdefchange_data(self):change_request=ChangeRequest.objects.filter(...)co_handler=ChangeRequestHandler()payload={'description':'updated description','title':'foo'}co_handler.close_change_request_with_error(change_request,payload)ModelsChangeRequestTheChangeRequestmodel has the following attributes:sys_id- The sys_id of the Change Request.number- Change Request Number.title- The title of the Change Request a.k.a short_description.description- Description for the change requestassignment_group_guid- The GUID of the group to which the Change Request is assigned tostate- The State of the Change Request. Can be any one of the followingChangeRequest’s constants:TICKET_STATE_OPEN- ‘1’TICKET_STATE_IN_PROGRESS- ‘2’TICKET_STATE_COMPLETE- ‘3’TICKET_STATE_COMPLETE_WITH_ERRORS- ‘4’Supported Ticket TypesChange Requests