Difference between revisions of "ResourceTemplateHelper"

From Catglobe Wiki
Jump to: navigation, search
(Created page with "{{CGscriptClass_Template |Name=ResourceTemplateHelper |Description=Helper class for fetching information about resource templates |Constructors= {{CGscriptConstructors_Templat...")
 
Line 15: Line 15:
 
{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=TypeInformation|HasGetter=1|Description=Get information about this class.}}
 
{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=TypeInformation|HasGetter=1|Description=Get information about this class.}}
 
}}
 
}}
 +
 +
=== Examples ===
 +
 +
<source lang="javascript">
 +
array list={
 +
Resource_Type_ResourceTemplate,
 +
Resource_Type_User,
 +
Resource_Type_Group,
 +
Resource_Type_ReportTemplate,
 +
Resource_Type_Project,
 +
Resource_Type_Folder,
 +
Resource_Type_QuestionnaireTemplate,
 +
Resource_Type_Attachment,
 +
Resource_Type_Questionnaire,
 +
Resource_Type_Report,
 +
Resource_Type_MessageTemplate,
 +
Resource_Type_Image,
 +
Resource_Type_Layout,
 +
Resource_Type_Product,
 +
Resource_Type_MessageFolder,
 +
Resource_Type_EmailAccount,
 +
Resource_Type_Diagram,
 +
Resource_Type_Asset,
 +
Resource_Type_WorkFlow,
 +
Resource_Type_QuestionnaireScript,
 +
Resource_Type_TabulationScript,
 +
Resource_Type_LayoutTemplate,
 +
Resource_Type_Coding,
 +
Resource_Type_Task,
 +
Resource_Type_System,
 +
Resource_Type_DataCacheSpecification,
 +
Resource_Type_TaskSet,
 +
Resource_Type_PaperQuestionnaire,
 +
Resource_Type_SampleRequest,
 +
Resource_Type_BulkMail,
 +
Resource_Type_Function,
 +
Resource_Type_DCSExport,
 +
Resource_Type_TestCase,
 +
Resource_Type_BulkSms
 +
};
 +
ResourceTemplateHelper a;
 +
array s=a.GetAllTemplates(list[33]);
 +
print(s);
 +
for(number i=0;i<s.Count;i++)
 +
{
 +
print("-----------");
 +
BulkSMSResourceTemplate n=s[i];
 +
print(n.ResourceId);
 +
print(n.ResourceName);
 +
print(n.LocalizedNames);
 +
};
 +
BulkSMSResourceTemplate templates=new BulkSMSResourceTemplate("Test bulk mail new SMS");
 +
templates.IsBulkDependant =true;
 +
templates.DependantSendToPartly = true;
 +
templates.DependantSendToCompleted = true;
 +
templates.DependantSendToNotStarted = true;
 +
templates.LocalizedNames = {"da-DK": "Test bulk mail"};
 +
templates.DefaultLanguage("da-DK");
 +
templates.Save();
 +
print("-----------");
 +
print(templates.ResourceId);
 +
print(templates.ResourceName);
 +
print(templates.LocalizedNames);
 +
</source>

Revision as of 11:05, 26 September 2016

ResourceTemplateHelper



Helper class for fetching information about resource templates

Constructors

  • () - Make new helper

Methods

  • Array of objects GetAllBulkMailTemplates() - Get all templates of the given type
  • Array of objects GetAllBulkSmsTemplates() - Get all templates of the given type
  • Array of objects GetAllTemplates(int resourceType "RESOURCE_TYPE_x to determine which list of resource templates to get") - Get resource templates specified by the resource type constant
  • string ToString() - The string representation of the object.

Properties

  • string ObjectTypeName { get; } - The name of the type of object.
  • TypeInformation TypeInformation { get; } - Get information about this class.


Examples

array list={
 Resource_Type_ResourceTemplate,
 Resource_Type_User,
 Resource_Type_Group,
 Resource_Type_ReportTemplate,
 Resource_Type_Project,
 Resource_Type_Folder,
 Resource_Type_QuestionnaireTemplate,
 Resource_Type_Attachment,
 Resource_Type_Questionnaire,
 Resource_Type_Report,
 Resource_Type_MessageTemplate,
 Resource_Type_Image,
 Resource_Type_Layout,
 Resource_Type_Product,
 Resource_Type_MessageFolder,
 Resource_Type_EmailAccount,
 Resource_Type_Diagram,
 Resource_Type_Asset,
 Resource_Type_WorkFlow,
 Resource_Type_QuestionnaireScript,
 Resource_Type_TabulationScript,
 Resource_Type_LayoutTemplate,
 Resource_Type_Coding,
 Resource_Type_Task,
 Resource_Type_System,
 Resource_Type_DataCacheSpecification,
 Resource_Type_TaskSet,
 Resource_Type_PaperQuestionnaire,
 Resource_Type_SampleRequest,
 Resource_Type_BulkMail,
 Resource_Type_Function,
 Resource_Type_DCSExport,
 Resource_Type_TestCase,
 Resource_Type_BulkSms
};
ResourceTemplateHelper a;
array s=a.GetAllTemplates(list[33]);
print(s);
for(number i=0;i<s.Count;i++)
{
 print("-----------");
 BulkSMSResourceTemplate n=s[i];
 print(n.ResourceId);
 print(n.ResourceName);
 print(n.LocalizedNames);
};
BulkSMSResourceTemplate templates=new BulkSMSResourceTemplate("Test bulk mail new SMS");
templates.IsBulkDependant =true;
templates.DependantSendToPartly = true;
templates.DependantSendToCompleted = true;
templates.DependantSendToNotStarted = true;
templates.LocalizedNames = {"da-DK": "Test bulk mail"};
templates.DefaultLanguage("da-DK");
templates.Save();
print("-----------");
print(templates.ResourceId);
print(templates.ResourceName);
print(templates.LocalizedNames);