Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
45
Is there a way to find out the DataKey of a variance activity?
posted

Hello,

 When you modify an activity that belongs to a series (one occurrence), a new activity record is created.  Is there a way to find the datakey for this new record either on a client or server side event?

Thanks,

alozada 

  • 245
    posted

    Me too has a similar problem. I cannot find a built function to do this. I ended up creating my own function to look up the last inserted activityID.

    You can use the Activity_Updated event of the WebSchedule.  I'm sure there is a more elegant solution to this hiding somewhere.

    protected void WebScheduleInfo1_ActivityUpdated(object sender, ActivityEventArgs e)

    {

        if (e.Activity.IsRecurring)

        {

                      //"open occurence", not a variance then add activitydetail variance

                     if (activitydetail.EditType == "2")

                     {

                                 //get last activityId inserted

                                 int activityId = Business.Logic.Schedules.Sched_GetLastInsertedActivityID(int.Parse(e.Activity.RecurrenceKey));

                      }

            }

    }