Beispiel 1

Beschreibung:

Erstellt eine neue Aufgabe.

VBScript:

Dim oProject : Set oProject = cRM.CurrentProject

Dim oActiveView : Set oActiveView = cRM.ActiveView

Dim oViewConfig : Set oViewConfig = oActiveView.Config

Dim oRecord : Set oRecord = oActiveView.CurrentRecordSet.CurrentRecord

Dim sCurrentUserLoginName : sCurrentUserLoginName = oProject.Users.CurrentUser.LoginName

Dim sPrimaryKeyFieldName : sPrimaryKeyFieldName = oViewConfig.PrimaryKeyFldName

Dim sRecordRefDescription : sRecordRefDescription = oRecord.GetRecordRefDescription

Dim sRefLink : sRefLink = oProject.ID & "|" & oActiveView.Name & "|" & oViewConfig.FamilyName & "|" & sPrimaryKeyFieldName & "|" & oRecord.GetContentsByName(sPrimaryKeyFieldName) & "|" & sRecordRefDescription

Set oRecord = Nothing

Set oViewConfig = Nothing

Set oActiveView = Nothing

Set oProject = Nothing

 

Dim oToDo : Set oToDo = cRM.CurrentProject.timemanager.ToDos.Add()

 

oToDo.ActionData = "info@relationship-manager.net"

oToDo.ActionID = "TMMAIL"

oToDo.ActionType = "1"

oToDo.Attendees.Add("LFrisch")

oToDo.Attendees.Add("THeld")

oToDo.Body = "{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1031{\fonttbl{\f0\fnil\fcharset0 Calibri;}}{\*\generator Riched20 10.0.22000}\viewkind4\uc1 \pard\sa200\sl276\slmult1\i\f0\fs22\lang7 Formatierter \b\i0 Inhalt/Text \b0 der \ul Aufgabe\ulnone\par}"

' oToDo.BodyPlain = "Inhalt/Text des Termins ohne RTF-Formatierung"

oToDo.Categories.Add("Meeting")

oToDo.ChangeDate = Now()

oToDo.ChangeUser = sCurrentUserLoginName

oToDo.Contact = "Kontakt, mit dem die Aufgabe stattfindet"

oToDo.CreationDate = Now()

oToDo.CreationUser = sCurrentUserLoginName

oToDo.End = DateAdd("h", 2, Now())

oToDo.ExtUserData1 = "Erster Abschnitt von Zusatzinformationen"

oToDo.ExtUserData2 = "Zweiter Abschnitt von Zusatzinformationen"

oToDo.HostDataBase = sRefLink

oToDo.Importance = 3

oToDo.Private = False

oToDo.Reminder = True

oToDo.ReminderMinutesBeforeStart = 30

oToDo.Start = DateAdd("h", 1, Now())

oToDo.Subject = "Priorität " & oToDo.Importance & ": Meeting im Büro mit " & sRecordRefDescription

oToDo.TimeStamp = FormatDateTime(Now(), vbGeneralDate)

oToDo.User = sCurrentUserLoginName

 

Dim sUniqueID : sUniqueID = oToDo.UniqueID

Call oToDo.Links.NewLink.SetLinkFromString(sRefLink)

 

Call oToDo.Save()

Call oToDo.ExportAsICal("C:\" & sRecordRefDescription & ".ical")

Call oToDo.Display()

Call oToDo.Remove()

 

Set oToDo = Nothing

C#-Script:

Project project = cRM.CurrentProject;

View activeView =cRM.ActiveView;

ViewConfig viewConfig = activeView.Config;

Record record = activeView.CurrentRecordSet.CurrentRecord;

string currentUserLoginName = project.Users.CurrentUser.LoginName;

string primaryKeyFieldName = viewConfig.PrimaryKeyFldName;

string recordRefDescription = record.GetRecordRefDescription();

string refLink = project.ID + "|" + activeView.Name + "|" + viewConfig.FamilyName + "|" + primaryKeyFieldName + "|" + record.GetContentsByName(primaryKeyFieldName) + "|" + recordRefDescription;

record.Dispose();

viewConfig.Dispose();

activeView.Dispose();

project.Dispose();

 

ToDo todo = cRM.CurrentProject.TimeManager.ToDos.Add();

 

todo.ActionData = "info@relationship-manager.net";

todo.ActionID = "TMMAIL";

todo.ActionType = "1";

todo.Attendees.Add("LFrisch");

todo.Attendees.Add("THeld");

todo.Body = @"{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1031{\fonttbl{\f0\fnil\fcharset0 Calibri;}}{\*\generator Riched20 10.0.22000}\viewkind4\uc1 \pard\sa200\sl276\slmult1\i\f0\fs22\lang7 Formatierter \b\i0 Inhalt/Text \b0 der \ul Aufgabe\ulnone\par}";

// todo.BodyPlain = "Inhalt/Text des Termins ohne RTF-Formatierung"

todo.Categories.Add("Meeting");

todo.ChangeDate = System.DateTime.Now;

todo.ChangeUser = currentUserLoginName;

todo.Contact = "Kontakt, mit dem die Aufgabe stattfindet";

todo.CreationDate = System.DateTime.Now;

todo.CreationUser = currentUserLoginName;

todo.End = System.DateTime.Now.AddHours(2);

todo.ExtUserData1 = "Erster Abschnitt von Zusatzinformationen";

todo.ExtUserData2 = "Zweiter Abschnitt von Zusatzinformationen";

todo.HostDatabase = refLink;

todo.Importance = 3;

todo.Private = false;

todo.Reminder = true;

todo.ReminderMinutesBeforeStart = 30;

todo.Start = System.DateTime.Now;

todo.Subject = "Priorität" + todo.Importance.ToString() + ": Meeting im Büro mit " + recordRefDescription;

todo.TimeStamp = System.DateTime.Now.ToString();

todo.User = currentUserLoginName;

 

string uniqueID = todo.UniqueID;

todo.Links.NewLink.SetLinkFromString(refLink);

 

todo.Save();

todo.ExportAsiCal(@"C:\" + recordRefDescription + ".ical");

todo.Display();

todo.Remove();

 

todo.Dispose();

TypeScript:

import {

  cRM,

  Project,

  ToDo,

  View,

  ViewConfig,

  Record,

} from "./sdk/combitCRM.SDK.WindowsClient.v13";

 

const project : Project = cRM.CurrentProject;

const activeView : View = cRM.ActiveView;

const viewConfig : ViewConfig = activeView.Config;

const record : Record = activeView.CurrentRecordSet.CurrentRecord;

 

const currentUserLoginName : string = project.Users.CurrentUser.LoginName;

const primaryKeyFieldName : string = viewConfig.PrimaryKeyFldName;

const recordRefDescription : string = record.GetRecordRefDescription();

 

const refLink : string = `${project.ID}|${activeView.Name}|${viewConfig.FamilyName}|${primaryKeyFieldName}|${record.GetContentsByName(primaryKeyFieldName)}|${recordRefDescription}`;

 

const toDo : ToDo = project.TimeManager.ToDos.Add();

 

toDo.ActionData = "info@relationship-manager.net";

toDo.ActionID = "TMMAIL";

toDo.ActionType = 1;

toDo.Attendees.Add("LFrisch");

toDo.Attendees.Add("THeld");

toDo.Body =

  "{\\rtf1\\ansi\\ansicpg1252\\deff0\\nouicompat\\deflang1031{\\fonttbl{\\f0\\fnil\\fcharset0 Calibri;}}{\\*\\generator Riched20 10.0.22000}\\viewkind4\\uc1 " +

  "\\pard\\sa200\\sl276\\slmult1\\i\\f0\\fs22\\lang7 Formatierter \\b\\i0 Inhalt/Text \\b0 der " +

  "\\ul Aufgabe\\ulnone\\par}";

toDo.Categories.Add("Meeting");

toDo.ChangeDate = new Date();

toDo.ChangeUser = currentUserLoginName;

toDo.Contact = "Kontakt, mit dem die Aufgabe stattfindet";

toDo.CreationDate = new Date();

toDo.CreationUser = currentUserLoginName;

toDo.End = new Date(Date.now() + 7200000);

toDo.ExtUserData1 = "Erster Abschnitt von Zusatzinformationen";

toDo.ExtUserData2 = "Zweiter Abschnitt von Zusatzinformationen";

toDo.HostDatabase = refLink;

toDo.Importance = 3;

toDo.Private = false;

toDo.Reminder = true;

toDo.ReminderMinutesBeforeStart = 30;

toDo.Start = new Date(Date.now() + 3600000);

toDo.Subject = `Priorität ${toDo.Importance}: Meeting im Büro mit ${recordRefDescription}`;

toDo.User = currentUserLoginName;

const uniqueID : string = toDo.UniqueID;

toDo.Links.NewLink().SetLinkFromString(refLink);

 

toDo.Save();

toDo.ExportAsICal(`C:\\${recordRefDescription}.ical`);

toDo.Display();

toDo.Remove();

ToDos Objekt