Creating a new service through API
Jump to navigation
Jump to search
Below is some javascript that shows how to create a new service and set some template fields through javascript:
var newGuid = CommonInterface.newGuid(); var knowledgeTemplateGuid = '8c09ea25-7187-41c2-89fc-f6473f2c0480'; var providerName = 'ServiceCatalogWriter'; var providerSecurityCheck = 'just-a-simple-password'; CommonInterface.callWebservice('Services: update service field', { 'ServiceGuid': newGuid, 'FieldName': 'template', 'ActorPerson': 1, 'Text': knowledgeTemplateGuid, 'ProviderName': providerName, 'SecurityCheck': providerSecurityCheck }); CommonInterface.callWebservice('Services: update template part text value', { 'ServiceGuid': newGuid, 'InternalName': 'Name', 'ActorPerson': 1, 'Text': 'New Knowledge Article', 'ProviderName': providerName, 'SecurityCheck': providerSecurityCheck }); CommonInterface.callWebservice('Services: update template part text value', { 'ServiceGuid': newGuid, 'InternalName': 'Description', 'ActorPerson': 1, 'Text': 'New Knowledge Article description', 'ProviderName': providerName, 'SecurityCheck': providerSecurityCheck }); CommonInterface.callWebservice('Services: update template part text value', { 'ServiceGuid': newGuid, 'InternalName': 'ExtensiveDescription', 'ActorPerson': 1, 'Text': 'And here you will find some more information\nabout this and that', 'ProviderName': providerName, 'SecurityCheck': providerSecurityCheck });
Another example to set the Service Manager
CommonInterface.callWebservice('Services: update template part text value', { 'ServiceGuid': newGuid, 'InternalName': 'ServiceManager', 'ActorPerson': 1, 'Text': 'uniqueidofmanager', 'ProviderName': providerName, 'SecurityCheck': providerSecurityCheck });