Creating a new service through API: Difference between revisions

From SMTX Wiki
Jump to navigation Jump to search
Created page with "Below is some javascript that shows how to create a new service and set some template fields through javascript: <nowiki>var newGuid = CommonInterface.newGuid(); var knowled..."
 
No edit summary
 
Line 10: Line 10:
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': '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 });
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 });
</nowiki>
Another example to set the Service Manager
<nowiki>
CommonInterface.callWebservice('Services: update template part text value', { 'ServiceGuid': newGuid, 'InternalName': 'ServiceManager', 'ActorPerson': 1, 'Text': 'uniqueidofmanager', 'ProviderName': providerName, 'SecurityCheck': providerSecurityCheck });
</nowiki>
</nowiki>

Latest revision as of 09:49, 29 March 2024

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 });