Pergapedia / SSP7
SMTX SupportSMTX Wiki
  • Introduction
  • Pergapedia / SSP7 Admin guide
  • Catalog
    • Typical use cases
      • Usage as Knowledge Catalog
      • Usage as Data Catalog
      • Usage as Service Catalog
    • Catalog Maintenance
      • Templates
        • Create a new template
        • Version management of templates
        • ACL (Access Control Lists)
          • Scopes
          • Add default ACLs
          • Remove All ACLS
          • ACL condition script examples
        • Set translation label for Publication request button
      • Parts (Fields)
        • Field types
        • Calculations
        • Field Validation examples
        • Field Visibility Examples
        • Field Filtering
        • Default value
      • Actors
      • Reusable content
      • Settings
      • General Settings
      • Roles
      • Javascript for Variables in processes
      • Action Forms
        • Add log entries for Action Forms
    • Service Maintenance
      • Services
        • Filter list of services
        • Duplicating services
        • Adding a new service
        • Service Details
          • General settings
          • Service Data
          • Contracts
          • Actors
          • Receivers
          • Targets
          • Support Groups
          • Relations
          • Requests
          • Quality Notes
          • Publication History
          • Documents
          • Log
          • Service Actions
        • Compare versions
        • Quality Notes
        • Service Changed flag
      • Approvals
      • Relations
        • Start service from service
      • Subscriptions
      • Outages
    • Public
    • Service Catalog API
      • Outbound REST API
        • Get Services
        • Get Service Details
      • Inbound SOAP calls
        • Create custom approval
        • Add log to service publish request
        • Add person to service person list
        • Add persongroup to service persongroup list
        • Delete service
        • Mark service publish request as in approval state
        • Process service publish request
        • Publish request set can be cancelled
        • Publish request set show in public
        • Remove person from service person list
        • Remove persongroup from service persongroup list
        • Remove support group from service
        • Update service field
        • Update service language field
        • Update template part datetime value
        • Update template part numeric value
        • Update template part text value
  • Fulfillment Platform
    • Admin Panel
    • General Settings
      • General
      • My Profile
      • Mail Settings
      • Login
      • Forms Setting
      • Workflow
      • Archive
      • Calendar Overview
      • Dashboard
      • Mobile Component
      • Ticketing
      • Webhooks
      • Goto
      • Search options
      • Application URL Settings
      • Address Book Settings
    • Dashboard
    • Categories
    • Topics
    • Forms
      • Fields-tab
      • Field: General Settings
      • Dynamic Value
      • Text (Area) Field
      • Yes : No Field
      • Upload file(s)
      • Date (Time) Field
      • Password Field
      • Read Only Display Field
      • Header
      • Tab
      • Section
      • Repeatable section buttons
      • Subform
      • Static HTML
      • Hidden Field
      • Selection Fields
      • Calculations
    • Processes
      • General Settings
      • Dynamic Field Mapping
      • Process Steps
      • Step Types
      • Logging
    • Datastore
      • Process interaction
      • Manage datastore entries via Webservices - Javascript
    • Tasks
    • Auto Forms
    • Adapters
      • Person Data
      • Web Services
    • Event triggers
    • Roles
    • Rolesets
    • Groups
    • Views
      • View Example 1
      • View example 2
    • Mail Templates
    • Layouts
    • Mail queue
    • Reporting
    • External Apps
    • My Items
    • Translations
    • Bulk Uploads
    • Help page
    • Goto
    • Search
    • Inbound Email
    • Reporting Dashboard
    • Ticketing
      • My Activities
      • Ticketing Views
      • External Integrations
    • Release Manager
    • Content Management Console module
    • SSP Studio
    • Persons & Accounts
    • Pools
  • Release Notes
    • Terms and Conditions
      • December 2024
    • Release 7.21.01
    • Release 7.21.03
    • Release 7.21.04
    • Release 7.21.05
    • Release 7.21.06
    • Release 7.21.07
    • Release 7.21.08
    • Release 7.21.09
    • Release 7.21.10
    • Release 7.21.11
    • Release 7.21.12
    • Release 7.22.02
    • Release 7.22.03
    • Release 7.22.04
    • Release 7.22.05
    • Release 7.22.06
    • Release 7.22.07
    • Release 7.22.08
    • Release 7.22.09
    • Release 7.22.10
    • Release 7.22.12
    • Release 7.23.01
    • Release 7.23.02
    • Release 7.23.03
    • Release 7.23.04
    • Release 7.23.05
    • Release 7.23.07
    • Release 7.23.08
    • Release 7.23.09
    • Release 7.23.10
    • Release 7.23.11
    • Release 7.23.12
    • Release 7.24.02
    • Release 7.24.03
    • Release 7.24.04
    • Release 7.24.05
    • Release 7.24.06
    • Release 7.24.07
    • Release 7.24.08
    • Release 7.24.09
    • Release 7.24.10
    • Release 7.24.11
    • Release 7.24.12
    • Release 7.25.01
    • Release 7.25.02
    • Release 7.25.03
    • Release 7.25.04
    • Release 7.25.05
  • Guides
    • Installation Guide
      • Scheduled Task installation
    • Upgrade Guide
    • LDAP Import
    • Training
      • Exercise : Create a new form
      • Exercise : Create a new Datastore Parameter
      • Exercise : Create a new Process
      • Exercise : Create a new Role
    • SubTopics in Topics
  • Pergapedia platform
Powered by GitBook
On this page
  • Action Form
  • Javascript v2 - with custom actors
  • Javascript v1 - zonder custom actors
  • Template - Action Form

Was this helpful?

  1. Catalog
  2. Service Maintenance
  3. Relations

Start service from service

PreviousRelationsNextSubscriptions

Last updated 11 months ago

Was this helpful?

Het aanmaken van een service via een action form, gekoppeld aan een service. Bij aanmaak van de nieuwe service willen we:

- Data overzetten van de bron-service

- De relatie leggen tussen de bron-service en de nieuw-aangemaakte service.

Setup:

- Voorzie een formulier waarin de GUID van de bron-service wordt getoond, alsook een keuze van template voor de nieuwe service.

Naamgeving:

- Bronservice: mother

- Aan te maken service: child

Action Form

Een voorbeeld vind je hier:

DEV SMTX:

General Settings

- Allow default values via URL

- On submit: Execute Javascript block

- Extra interface(s) : ServiceCatalogInterface

- In het vakje ‘Script’ komt dan de JS – zie verder in dit document.

Benodigde velden:

- Field met internal label ‘serviceguid’ die de GUID bevat

o Hier hoeft geen default value in te komen, we vullen die via de URL

- Field met internal label ‘ChildSelection’ die de naam van de template geeft

o In dit geval: Demo Template from Template - Amendement onderzoek

o Dit is nu een read-only display field, maar kan perfect een dropdown zijn met meerdere templates. Let wel dat de target fields gelijk moeten zijn. Indien ze verschillend zijn, zal je een ander formulier moeten aanmaken, omdat de JS verschillend is.

Javascript v2 - with custom actors

The code below nos supports transferring custom actor, a few examples are entered.

--------------------

var forminstance = JSON.parse(g_forminstance_string);

var externalprovidername = "ServiceCatalogWriter";

var externalproviderkey = "i-can-write";

var actorperson = forminstance.requestedforpersonid;

//currently no language dependent fields are supported

// Below are the fields to be copied

var fieldstocopy = [

{ sourcename: "Study_number", targetname: "Study_number" },

{ sourcename: "Full_study_title", targetname: "Full_study_title" },

{ sourcename: "Department_PI", targetname: "Department_PI" },

{ sourcename: "STU_CEC", targetname: "Amend_CEC" },

{ sourcename: "Acronym", targetname: "Acronym" },

];

// below are

var customactorstocopy = [

{ sourcename: "Principal_Investigator", targetname: "Principal_Investigator" },

{ sourcename: "Subinvestigators", targetname: "Subinvestigators" },

{ sourcename: "Study_Team_Members", targetname: "Study_Team_Members" },

{ sourcename: "Sponsor_submission", targetname: "Sponsor_submission" },

{ sourcename: "Sponsor_contract", targetname: "Sponsor_contract" },

{ sourcename: "Students", targetname: "Students" },

];

var templateselections = forminstance.values.filter(function (v) { return v.internallabel === "ChildSelection"; });

var sourceserviceguids = forminstance.values.filter(function (v) { return v.internallabel === "serviceguid"; });

if (templateselections.length === 1 && sourceserviceguids.length === 1) {

var newservicetemplatename = templateselections[0].value;

var sourceserviceguid = sourceserviceguids[0].value;

if (newservicetemplatename && sourceserviceguid) {

var sourceservice = JSON.parse(ServiceCatalogInterface.getServiceDetail(sourceserviceguid, { PartsUseValue: true, PartsAsFlatList: true, LoadRelations: false }));

if (sourceservice) {

var newserviceguid = CommonInterface.newGuid();

//set the template of the service, this creates the service too

var result = CommonInterface.callWebservice("Services: update service field", { ServiceGuid: newserviceguid, FieldName: "template", ActorPerson: actorperson, Text: newservicetemplatename, ProviderName: externalprovidername, SecurityCheck: externalproviderkey });

if (result === "OK") {

var errors = [];

//add relation

result = CommonInterface.callWebservice("Services: add relation", { ParentServiceGuid: sourceserviceguid, ChildServiceGuid: newserviceguid, ActorPerson: actorperson, ProviderName: externalprovidername, SecurityCheck: externalproviderkey });

if (result !== "OK") {

errors.push("Failed to add relation: " + result);

}

//copy fields

fieldstocopy.forEach(function (fieldtocopy) {

var sourcefields = sourceservice.parts.filter(function (part) { return part.internalname === fieldtocopy.sourcename; });

if (sourcefields.length > 0) {

var sourcefield = sourcefields[0];

//only copy when there's a value, makes no sense if empty

if (sourcefield.value) {

if (fieldtocopy.fieldtype === "numeric") {

result = CommonInterface.callWebservice("Services: update template part numeric value", { ServiceGuid: newserviceguid, InternalName: fieldtocopy.targetname, ActorPerson: actorperson, Numeric: sourcefield.value, ProviderName: externalprovidername, SecurityCheck: externalproviderkey });

} else if (fieldtocopy.fieldtype === "datetime") {

result = CommonInterface.callWebservice("Services: update template part datetime value", { ServiceGuid: newserviceguid, InternalName: fieldtocopy.targetname, ActorPerson: actorperson, DateTime: sourcefield.value, ProviderName: externalprovidername, SecurityCheck: externalproviderkey });

} else {

result = CommonInterface.callWebservice("Services: update template part text value", { ServiceGuid: newserviceguid, InternalName: fieldtocopy.targetname, ActorPerson: actorperson, Text: sourcefield.value, ProviderName: externalprovidername, SecurityCheck: externalproviderkey });

}

if (result !== "OK") {

errors.push("Failed to set field " + fieldtocopy.targetname + ": " + result);

}

}

} else {

//field not found

errors.push("Field " + fieldtocopy.sourcename + " not found in source service");

}

});

//copy actors

customactorstocopy.forEach(function (customactortocopy) {

var sourcecustomactors = sourceservice.customactors.filter(function (customactor) { return customactor.internalname === customactortocopy.sourcename; });

if (sourcecustomactors.length > 0) {

var sourcecustomactor = sourcecustomactors[0];

//only copy when there's a value, makes no sense if empty

if (sourcecustomactor.value) {

var ismultiple = sourcecustomactor.typename === "Multiple_persons" || sourcecustomactor.typename === "Multiple_person_groups";

var ispersongroup = sourcecustomactor.typename === "Single_person_group" || sourcecustomactor.typename === "Multiple_person_groups";

if (ismultiple) {

//value is array of person or persongroup

if (Array.isArray(sourcecustomactor.value)) {

sourcecustomactor.value.forEach(function (personorpersongroup) {

if (personorpersongroup) {

//need to call the Services: add person to service person list or Services: add persongroup to service persongroup list

if (ispersongroup) {

result = CommonInterface.callWebservice("Services: add persongroup to service persongroup list", { ServiceGuid: newserviceguid, TypeName: "CustomActor", CustomActorInternalName: customactortocopy.targetname, ActorPerson: actorperson, PersonGroup: personorpersongroup.id, ProviderName: externalprovidername, SecurityCheck: externalproviderkey });

} else {

result = CommonInterface.callWebservice("Services: add person to service person list", { ServiceGuid: newserviceguid, TypeName: "CustomActor", CustomActorInternalName: customactortocopy.targetname, ActorPerson: actorperson, Person: personorpersongroup.id, ProviderName: externalprovidername, SecurityCheck: externalproviderkey });

}

if (result !== "OK") {

errors.push("Failed to add custom actor " + customactortocopy.targetname + ": " + result);

}

}

});

} else {

errors.push("Failed to set custom actor " + customactortocopy.targetname + ": value is not an array");

}

} else {

//value is person or persongroup

//need to call the Services: save custom actor person to service or Services: save custom actor person group to service

if (ispersongroup) {

result = CommonInterface.callWebservice("Services: save custom actor person group to service", { ServiceGuid: newserviceguid, CustomActorInternalName: customactortocopy.targetname, ActorPerson: actorperson, PersonGroup: sourcecustomactor.value.id, ProviderName: externalprovidername, SecurityCheck: externalproviderkey });

} else {

result = CommonInterface.callWebservice("Services: save custom actor person to service", { ServiceGuid: newserviceguid, CustomActorInternalName: customactortocopy.targetname, ActorPerson: actorperson, Person: sourcecustomactor.value.id, ProviderName: externalprovidername, SecurityCheck: externalproviderkey });

}

if (result !== "OK") {

errors.push("Failed to set custom actor " + customactortocopy.targetname + ": " + result);

}

}

}

} else {

//custom actor not found

errors.push("Custom actor " + customactortocopy.sourcename + " not found in source service");

}

});

var toreturn = "Amendment created, <a href='" + CommonInterface.getSspUrl() + "/ServiceCatalog/Admin/ServiceAddEdit.aspx?genericguid=" + newserviceguid + "' target='_top'>click here to access the new amendment.</a>";

if (errors.length) {

toreturn += "<br />Attention, errors occured:<ul>" + errors.map(function (er) { return "<li>" + CommonInterface.htmlEncode(er) + "</li>"; }).join("") + "</ul>";

}

return toreturn;

} else {

return "Creation of service failed: " + result;

}

} else {

return "Source service not found";

}

} else {

return "One or more form fields are empty";

}

} else {

return "One or more form fields not found";

}

Javascript v1 - zonder custom actors

In de code hoef je enkel de gele teksten aan te passen. Deze omvatten de over te zetten velden en het bericht met de link na aanmaak van de nieuwe service. De guid & aan te maken template komen uit het formulier.

Start code:

var forminstance = JSON.parse(g_forminstance_string);

var externalprovidername = "ServiceCatalogAPI";

var externalproviderkey = "50bK3v3b59coDb@ZZjF#sTFaE8c7iR&n";

var actorperson = forminstance.requestedforpersonid;

//currently no language dependent fields are supported

var fieldstocopy = [

{ sourcename: "study_title", targetname: "study_title" },

{ sourcename: "st_title_ENG", targetname: "st_title_ENG" },

{ sourcename: "aanvraag_acacom", targetname: "aanvraag_acacom" },

];

//hier bepalen we via de internal labels welke de bron en doelvelden zijn – sourcename is de bron, targetname is in de aan te maken service

var templateselections = forminstance.values.filter(function (v) { return v.internallabel === "ChildSelection"; });

//Declaratie van het internal label van het veld in het formulier waarin de template van de aan te maken service wordt gekozen

var sourceserviceguids = forminstance.values.filter(function (v) { return v.internallabel === "serviceguid"; });

//Declaratie van het internal label van het veld in het formulier waarin de GUID van de bron-service wordt meegegeven

if (templateselections.length === 1 && sourceserviceguids.length === 1) {

var newservicetemplatename = templateselections[0].value;

var sourceserviceguid = sourceserviceguids[0].value;

if (newservicetemplatename && sourceserviceguid) {

var sourceservice = JSON.parse(ServiceCatalogInterface.getServiceDetail(sourceserviceguid, { PartsUseValue: true, PartsAsFlatList: true, LoadRelations: false }));

if (sourceservice) {

var newserviceguid = CommonInterface.newGuid();

//set the template of the service, this creates the service too

var result = CommonInterface.callWebservice("Services: update service field", { ServiceGuid: newserviceguid, FieldName: "template", ActorPerson: actorperson, Text: newservicetemplatename, ProviderName: externalprovidername, SecurityCheck: externalproviderkey });

if (result === "OK") {

var errors = [];

//add relation

result = CommonInterface.callWebservice("Services: add relation", { ParentServiceGuid: sourceserviceguid, ChildServiceGuid: newserviceguid, ActorPerson: actorperson, ProviderName: externalprovidername, SecurityCheck: externalproviderkey });

if (result !== "OK") {

errors.push("Failed to add relation: " + result);

}

//copy fields

fieldstocopy.forEach(function (fieldtocopy) {

var sourcefields = sourceservice.parts.filter(function (part) { return part.internalname === fieldtocopy.sourcename; });

if (sourcefields.length > 0) {

var sourcefield = sourcefields[0];

//only copy when there's a value, makes no sense if empty

if (sourcefield.value) {

if (fieldtocopy.fieldtype === "numeric") {

result = CommonInterface.callWebservice("Services: update template part numeric value", { ServiceGuid: newserviceguid, InternalName: fieldtocopy.targetname, ActorPerson: actorperson, Numeric: sourcefield.value, ProviderName: externalprovidername, SecurityCheck: externalproviderkey });

} else if (fieldtocopy.fieldtype === "datetime") {

result = CommonInterface.callWebservice("Services: update template part datetime value", { ServiceGuid: newserviceguid, InternalName: fieldtocopy.targetname, ActorPerson: actorperson, DateTime: sourcefield.value, ProviderName: externalprovidername, SecurityCheck: externalproviderkey });

} else {

result = CommonInterface.callWebservice("Services: update template part text value", { ServiceGuid: newserviceguid, InternalName: fieldtocopy.targetname, ActorPerson: actorperson, Text: sourcefield.value, ProviderName: externalprovidername, SecurityCheck: externalproviderkey });

}

if (result !== "OK") {

errors.push("Failed to set field " + fieldtocopy.targetname + ": " + result);

}

}

} else {

//field not found

errors.push("Field " + fieldtocopy.sourcename + " not found in source service");

}

});

var toreturn = "Item aangemaakt, <a href='" + CommonInterface.getSspUrl() + "/ServiceCatalog/Admin/ServiceAddEdit.aspx?genericguid=" + newserviceguid + "' target='_top'>klik hier om er naartoe te gaan.</a>";

// Hierboven staat de tekst die de gebruiker ziet na aanmaak van de nieuwe service. Deze bevat ook de link om erheen te gaan. Deze link is omgeving-onafhankelijk.

if (errors.length) {

toreturn += "<br />Opgepast, er waren enkele problemen:<ul>" + errors.map(function (er) { return "<li>" + CommonInterface.htmlEncode(er) + "</li>"; }).join("") + "</ul>";

}

return toreturn;

} else {

return "Creation of service failed: " + result;

}

} else {

return "Source service not found";

}

} else {

return "One or more form fields are empty";

}

} else {

return "One or more form fields not found";

}

Template - Action Form

Koppel het Action form aan de moeder-template.

In dit geval : Demo Template from template - Algemeen onderzoek

Welke velden zet ik over:

Bron

Int. label

Type

Target Int. label

Dutch title of the study

study_title

Multiple text lines

study_title

English title of the study

st_title_ENG

Multiple text lines

st_title_ENG

I wish to submit an application concerning

aanvraag_acacom

radio

aanvraag_acacom

https://dev.ssp7.smt-x.com/Forms/Admin/formDetail.aspx?id=726