|
Home > Archive > Commerce Server General > November 2006 > Object required: 'context.dataFunctions'
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Object required: 'context.dataFunctions'
|
|
| Stephan 2006-11-03, 1:16 pm |
| Hi,
I wantet to implement the automatically response for an order. For that i
have got the example from the book "Building Solutions with Microsoft
Commerce Server 2002". My problem ist that the Scriptor fails in the
mscsexecute function when it wants to get the context.dataFunctions. Funny is
that there are posts in different forums wehre someone had the same problem
but nowehere at all is any response.
For your information here the Script code:
Function MSCSExecute(config, orderform, context, flags)
Dim mscsMessageManager, mscsDataFunctions
Dim msgBody
''Set mscsMessagemanager = context.MessageManager
Set mscsDataFunctions = context.DataFunctions
orderform.[_email_subject] = "Order Confirmation #: " & _
orderform.[order_id]
msgBody = "Thank you for your order." & chr(10) & chr(13) & _
"Order id: " & orderform.[order_id] & chr(10) & char(13) & _
"Order date: " & MscDataFunctions.Date(orderform.[date_changed]) & _
chr(10) & chr(13) & _
"Order total: " &_
MscDataFunctions.Money(Clng(orderform.[_cy_total_total])) & _
chr(10) & chr(13) & chr(10) & chr(13)
Dim shipments
shipments = orderform.[shipments]
msgBody = msgBody & "Shipping Addresses" & chr(10) & chr(13)
for each shipment in shipments
shippingAddressId = shipment.[shipping_address_id]
shippingAddress = orderform.[Addresses].Value(shippingAddressId)
msgBody = msgBody & shippingAddress.[address_name] & chr(10) & chr(13) & _
shippingAddress.[address_line1] & chr(10) & chr(13)
if Len(shippingAddress.[addres2])>0 Then
msgBody = msgBody & shippingAddress.[address_line2] & chr(10) & chr(13)
End If
msgBody = msgBody & shippingAddres.[city[ & ", " &
shippingAddress.[region_code] & "" & _
shippingAddress.[postal_code] & chr(10) & chr(13) & chr(10) & chr(13)
next
orderform.[_email_body] = msgBody
MSCSExecute = 1
End Function' VBScript source code
Does anyone have an idea how to solve that problem?
Cheers
| |
| Joseph Johnson 2006-11-03, 1:16 pm |
| Stephan,
The objects attached to that context dictionary are normally added prior to
actually running the pipeline. You can see some examples of how this is
done by looking at examples of people using the PipelineInfo or
PipelineContext class. It's actually a good way to pass external
information which isn't part of an order into the pipeline (such as database
connection strings, or any other configuration-dependent values).
I was able to dig up this KB article, but i don't think it's the same error
you're seeing:
http://support.microsoft.com/defaul...kb;en-us;261587
Perhaps you need to instantiate a new instance of this class outside of the
pipeline and attach it to the PipelineContext? I wouldn't use this
functionality if you plan on porting this over to CS2007, though, as I don't
even think the DataFunctions class is available in that version.
Joe
"Stephan" <Stephan@discussions.microsoft.com> wrote in message
news:36C73A64-4528-403A-B8A6-C05EFA37449D@microsoft.com...
> Hi,
>
> I wantet to implement the automatically response for an order. For that i
> have got the example from the book "Building Solutions with Microsoft
> Commerce Server 2002". My problem ist that the Scriptor fails in the
> mscsexecute function when it wants to get the context.dataFunctions. Funny
> is
> that there are posts in different forums wehre someone had the same
> problem
> but nowehere at all is any response.
>
> For your information here the Script code:
>
> Function MSCSExecute(config, orderform, context, flags)
> Dim mscsMessageManager, mscsDataFunctions
> Dim msgBody
>
> ''Set mscsMessagemanager = context.MessageManager
> Set mscsDataFunctions = context.DataFunctions
>
> orderform.[_email_subject] = "Order Confirmation #: " & _
> orderform.[order_id]
> msgBody = "Thank you for your order." & chr(10) & chr(13) & _
> "Order id: " & orderform.[order_id] & chr(10) & char(13) & _
> "Order date: " & MscDataFunctions.Date(orderform.[date_changed]) & _
> chr(10) & chr(13) & _
> "Order total: " &_
> MscDataFunctions.Money(Clng(orderform.[_cy_total_total])) & _
> chr(10) & chr(13) & chr(10) & chr(13)
>
> Dim shipments
>
> shipments = orderform.[shipments]
>
> msgBody = msgBody & "Shipping Addresses" & chr(10) & chr(13)
> for each shipment in shipments
> shippingAddressId = shipment.[shipping_address_id]
> shippingAddress = orderform.[Addresses].Value(shippingAddressId)
> msgBody = msgBody & shippingAddress.[address_name] & chr(10) & chr(13) & _
> shippingAddress.[address_line1] & chr(10) & chr(13)
> if Len(shippingAddress.[addres2])>0 Then
> msgBody = msgBody & shippingAddress.[address_line2] & chr(10) & chr(13)
> End If
> msgBody = msgBody & shippingAddres.[city[ & ", " &
> shippingAddress.[region_code] & "" & _
> shippingAddress.[postal_code] & chr(10) & chr(13) & chr(10) & chr(13)
> next
> orderform.[_email_body] = msgBody
> MSCSExecute = 1
> End Function' VBScript source code
>
> Does anyone have an idea how to solve that problem?
>
> Cheers
| |
| Colin Bowern 2006-11-07, 1:22 am |
| Stephan,
Ravi had a good post on some things that needed to be done to get
DataFunctions working here:
http://groups.google.ca/group/micro...8737f6d388db29b
Can you remove all the lines in your code and add one element at a time to
isolate where the problem is?
1. First run -
Set mscsMessagemanager = context.MessageManager
2. Second run -
Set mscsMessagemanager = context.MessageManager
Set mscsDataFunctions = context.DataFunctions
3. Third run -
Set mscsMessagemanager = context.MessageManager
Set mscsDataFunctions = context.DataFunctions
orderform.[_email_subject] = "Order Confirmation #: "
4. Fourth run -
Set mscsMessagemanager = context.MessageManager
Set mscsDataFunctions = context.DataFunctions
orderform.[_email_subject] = "Order Confirmation #: " & orderform.[order_id]
5. Fifth run -
Set mscsMessagemanager = context.MessageManager
Set mscsDataFunctions = context.DataFunctions
orderform.[_email_subject] = "Order Confirmation #: " & orderform.[order_id]
msgBody = "Thank you for your order." & chr(10) & chr(13) & "Order id: " &
orderform.[order_id] & chr(10) & char(13) & "Order date: "
6. Sixth run -
Set mscsMessagemanager = context.MessageManager
Set mscsDataFunctions = context.DataFunctions
orderform.[_email_subject] = "Order Confirmation #: " & orderform.[order_id]
msgBody = "Thank you for your order." & chr(10) & chr(13) & "Order id: " &
orderform.[order_id] & chr(10) & char(13) & "Order date: " &
MscDataFunctions.Date(orderform.[date_changed])
etc...
Also, can you use the PIPELOG, DumpOrder.vbs, or XmlTracer to verify that
there is in fact data in the date_changed and _cy_total_total fields?
Cheers,
Colin
--
The group is moving! Check out Commerce Server discussion forums on MSDN:
http://forums.microsoft.com/msdn/de...id=294&SiteID=1
For more on my experiences with Commerce Server:
http://colin.rockstarguys.com
"Joseph Johnson" <joe8t88@hotmail.com> wrote in message
news:#T2ol71$GHA.4852@TK2MSFTNGP03.phx.gbl...
> Stephan,
>
> The objects attached to that context dictionary are normally added prior
> to actually running the pipeline. You can see some examples of how this
> is done by looking at examples of people using the PipelineInfo or
> PipelineContext class. It's actually a good way to pass external
> information which isn't part of an order into the pipeline (such as
> database connection strings, or any other configuration-dependent values).
>
> I was able to dig up this KB article, but i don't think it's the same
> error you're seeing:
>
> http://support.microsoft.com/defaul...kb;en-us;261587
>
> Perhaps you need to instantiate a new instance of this class outside of
> the pipeline and attach it to the PipelineContext? I wouldn't use this
> functionality if you plan on porting this over to CS2007, though, as I
> don't even think the DataFunctions class is available in that version.
>
> Joe
>
>
>
> "Stephan" <Stephan@discussions.microsoft.com> wrote in message
> news:36C73A64-4528-403A-B8A6-C05EFA37449D@microsoft.com...
>
>
|
|
|
|
|