Date Conversions

ATTENTION: This forum is no longer active. Please navigate to our new support site at https://support.starfishetl.com/
Viewing 3 posts (of 3 total)
Anosh Wadia
User - Author
Post count: 19
#1

I'm importing Activites from Goldmine to SalesForce using Starfish

The goldmine data has the date split into date and time using the fields
ONDATE and ONTIME

Salesforce needs the data to be in a single date field.

I'm trying to use a Function that will combine these into a single date so I tried using:

Function ScriptedField
ScriptedField= cdate("@@ORG:ONDATE@@" + "@@ORG:ONDATE@@")
End Function

But that fails the Check.

In fact if I just use:
Function ScriptedField
ScriptedField= cdate("@@ORG:ONDATE@@")
End Function

That fails as well, both of the above give the error:

Starfish Script Error: Type mismatch: 'cdate'
Line: 2

Can I not use the CDate vbscript function with Starfish?

Thanks!
Anosh

Comments (3)

Aron Hoekstra's picture Aron Hoekstra
Administrator
Post count: 2
#2

Yes, you can use the CDate function, however when you use the Check box, it does not resolve variables.. so it's trying to convert date on text, which will cause that error. By the next version of Starfish, I'll like to improve that so the variables are resolved when you test the script.

Also, note sometimes in goldmine the date is populated but the time field is not. So it may be necessary to use IsDate on the Date+Time concatenation, if that fails - use Date only.

Log in to post comments
Anosh Wadia's picture Anosh Wadia
User - Author
Post count: 19
#3

Hi Aron,

Thanks for the suggestions. So given your comments above, would you say the following function would be correct for importing from Goldmine?

Function ScriptedField
If IsDate(CDate("@@ORG:ONDATE@@" + "@@ORG:ONTIME@@")) Then
ScriptedField=CDate("@@ORG:ONDATE@@" + "@@ORG:ONTIME@@")
Else
ScriptedField=CDate("@@ORG:ONDATE@@")
End If
End Function

Thanks!
Anosh

Log in to post comments
Aron Hoekstra's picture Aron Hoekstra
Administrator
Post count: 2
#4

Yes that looks good to me, though I would probably take that one step further and double check the Date Only to be IsDate too. Salesforce is picky about date formats.

Log in to post comments
Viewing 3 posts (of 3 total)

Forum Login

Login or sign up for our forums to connect to the user community.

Reply

You must log in to post.

Not a Member? Register.