1

I'm trying to create a data extension from a landing page using some Ampscript. So far I have got this:

%%[
var @jobno, @de, @deFields, @StatCode, @ts_attr, @StatMessage, @ErrorCode
set @jobno = RequestParameter("jobno")
set @de = CreateObject(@jobno)

/*CREATE DATA EXTENSION */
SetObjectProperty(@de,"Name",@jobno)
SetObjectProperty(@de,"CustomerKey",@jobno)
SetObjectProperty(@de,"Description",Concat("DE created at ",Now()))
SetObjectProperty(@de,"IsSendable","True")
SetObjectProperty(@de,"IsTestable","False")
SetObjectProperty(@de,"CategoryID","15209")

/*CREATE SENDABLE FIELD*/
Set @deFields = CreateObject("DataExtensionField")
SetObjectProperty(@deFields,"FieldType","EmailAddress")
SetObjectProperty(@deFields,"IsRequired","true")
SetObjectProperty(@deFields,"IsPrimaryKey","false")
SetObjectProperty(@deFields,"IsNillable","false")
SetObjectProperty(@deFields,"MaxLength","254")
SetObjectProperty(@deFields,"Name","Email_Address")
AddObjectArrayItem(@de,"Fields",@deFields)

SetObjectProperty(@de,"SendableDataExtensionField",@deFields)

SET @ts_attr = CreateObject("Attribute")
SetObjectProperty(@ts_attr, "Name", "Email Address")
SetObjectProperty(@ts_attr, "Value", "Email Address")
SetObjectProperty(@de,"SendableSubscriberField",@ts_attr)

Set @StatCode = InvokeCreate(@de, @StatMessage, @ErrorCode)


]%%

Status = %%= v(@StatMessage) =%% -- %%= v(@ErrorCode) =%%

But when I run it, I get this error:

Error Message: Could not load type 'ExactTarget.Integration.WSDL.ACI_12507_APP_CAM_02' from assembly 'ExactTarget.Api.Generated'. Description: An unexpected error occurred during the execution of the page. line 0, column 0 Exception Info: An error occurred when attempting to evaluate a CreateObject function call. See inner exception for details.

System.TypeLoadException: Could not load type 'ExactTarget.Integration.WSDL.ACI_12507_APP_CAM_02' from assembly 'ExactTarget.Api.Generated'. Source: mscorlib

Where am I going wrong?

  • What is "IsNillable"? Maybe the typo is getting you? – Timothy Feb 26 '18 at 19:44
  • Sadly not - 'Nillable' is indeed correct, and not 'Nullable' as you'd expect. – TCassa Feb 27 '18 at 9:35
  • That's embarrassing. OK, so a couple of thoughts: I would move the InvokeCreate call above the attribute, comment out the CreateObject("Attribute") section, and see if it works. Secondly, I assume you are working off the documentation at developer.salesforce.com/docs/… ? You should be using the example using the subscriber key, not Email Address. – Timothy Feb 27 '18 at 19:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.