0

I'm trying to create a Sales Cloud task using AMPscript. There's not much detailed documentation out there so I'm trying different API field names and haven't figured it out. Here's my code:

    var @createtask
    set @createtask = CreateSalesforceObject(
        'Task', 6,
        'Priority', 'High',
        'Status', 'Not Started',
        'OwnerId', 'xxxx',
        'WhoId', @ID,
        'WhatId', 'xxxxx',
        'Subject', 'Task 123'
        )
  • What is your question? What issues are you encountering? are you defining @id somewhere? – EazyE Jul 26 at 17:55
  • Yes contact or lead ID is defined. I've been unable to successfully create a task with the above code. – Jason Lepes Jul 26 at 17:58
0

This can be frustrating indeed.

ask these questions:

  • Are you using the API Name of all Sales Cloud fields, not the label?

  • Do you have all mandatory fields included for, in your case, task?

I found it helpful to limit myself to only mandatory fields. Once this works, advance field by field. While doing that, don't forget the next point...

  • is the number of fields stated in the call correct? (in your case, 6 looks correct)

  • for picklists: are all the field values you are trying to set exactly matching an existing picklist value?

  • for text fields: is your value you within the defined maxlength?

  • Are you including date fields? If yes, Format(@mydate,iso) helps.

    • For lookups: is the ID (still) valid in this org (careful with sandboxes)

all of this can be fixed in your code. Also check creating the record manually with a user that has equivalent permissions as your API user, to test against this:

  • Are there any validations within Sales Cloud that forbid the creation?

  • In the connector, do you have read and write access on the object (normally, you should)?

To isolate: Can you create another object (e.g. lead?)- again, note that you need all mandatory fields like lastname, company and have the correct number of fields specified.

  • Thanks for the help. MC support is assisting. I will post an update once I've got this working. – Jason Lepes Jul 30 at 0:41

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.