Community
Showing results for 
Search instead for 
Do you mean 
Reply

Activity not found after creating it

Copper Contributor
Posts: 89
Country: Netherlands

Activity not found after creating it

I've used this for some time, but suddenly it seems to not work anymore.

 

I have a standalone application, which logs in to Act!.

I create an activityTemplate, save it, and then I want to clear it and create history. Therefore I need an Activity object.

But when I retrieve the activity with the activtiyTemplate's activityId, it gives me 'null'.

 

Why is that?

 

code:

 

// SET TYPE
ActivityType type = ACTFM.Activities.GetActivityType(StandardActivityType.Meeting);

 

// SET PLANNED FOR
Contact me = ACTFM.Contacts.GetMyRecord();
User usr_me = ACTFM.Users.GetUser(me);

 

// PLAN ACTIVITY TYPE
DateTime start = DateTime.Now.AddMinutes(0 - duration_minutes);
ActivityTemplate actT = ACTFM.Activities.CreateActivity(type, start, start.AddMinutes(duration_minutes), me.ID);
actT.IsTimeless = false;

 

// SET REGARDING
actT.Regarding = "test";

// ATTACH MYSELF AS CONTACT
actT.ActivityContacts.Add(ACTFM.Contacts.GetMyRecord());

 

// SAVE
actT.Update();

 

// FIND THE ACTIVITY OBJECT.
Guid activityID = actT.ActivityId;
ActivityList al = ACTFM.Activities.GetActivityInstancesByActivityId(new Guid[] { activityID }); // al.count is 0 !!!

 

Also, the approach of using the CreateActivityComplete event (as described here https://community.act.com/t5/Act-Developer-s-Forum/Activity-Template-and-ActivityID-field/m-p/317619... did not work, the event didn't even fire (I atttach the eventhandler after logon). Maybe this is something only works in an add-on? This is a standalone application which logs in into Act!.

Greetings,

ACT Certified Consultants
TendenZ
the Netherlands