Community
Showing results for 
Search instead for 
Do you mean 
Reply

Question on Creating a History with the SDK/VB Script

Copper Contributor
Posts: 144
Country: USA

Question on Creating a History with the SDK/VB Script

Hello---For the record, not a progammer, but an ACC.

 

I am working to create a new history with this fragment of code.

 

NewHistory = ActFwk.Histories.CreateHistory(currentContact, Guid.Empty, hisType, False, System.DateTime.Now, System.DateTime.Now, sRegarding, "")

 

The code works, and I just want to refine it slightly.

 

The result is:

Appeal Date - 4/23/2013 12:00:00 AM in the regarding field.

 

I'd rather just have

Appeal Date - 4/23/2013

 

I tried taking out the second system.dateTime.now command, but ACT didn't like that.

 

Running ACT! 2012, and I know it's VB.net being used.

 

Thanks.

 

Mark Mondo

MondoCRM

www.mondocrm.com

 

Bronze Elite Contributor
Posts: 2,115
Country: United_Kingdom

Re: Question on Creating a History with the SDK/VB Script

I haven't tested this, but you could try:

NewHistory = ActFwk.Histories.CreateHistory(currentContact, Guid.Empty, hisType, False, System.DateTime.Now.Date, System.DateTime.Now.Date, sRegarding, "")

 

Vivek Gargav
Caldere Associates Ltd.
www.caldere.com
vgargav@caldere.com
My Blog
Copper Contributor
Posts: 144
Country: USA

Re: Question on Creating a History with the SDK/VB Script

Hi Vivek - No luck. It still shows up as 12:00:00 AM.

Mark M
Employee
Posts: 1,163
Country: USA

Re: Question on Creating a History with the SDK/VB Script

[ Edited ]

What is sRegarding? The next to last parameter for that method is the regarding string and that's what you'd want to modify to have regarding appear as you'd like.

 

The second DateTime you tried to remove is the end time for the history, that's why Act didn't like it.

Matthew Wood
Act! SDK Support
Community Moderator
Nickel Contributor
Posts: 175
Country: USA

Re: Question on Creating a History with the SDK/VB Script

Act is using SQL Server as the back-end database. I'm taking an educated guess here, but that particular field is probably declared as DateTime or SmallDateTime in SQL Server. Either one of these will automatically add the time of "12:00:00 AM" to the value if no time value is supplied. "Removing" the time is something that is usually taken care of by the front-end application (Act in this case) via formatting. The time portion isn't actually going to be removed when you format that data, you are just changing how the value is displayed. In this case, the formatting would ignore the time portion of the full DateTime value. I hope this helps out.