Skip to main content
deleted 12 characters in body
Source Link

I would like to close the discussion thread on this related topic Manage automation via ampscript API. If you have additional information to complement it would be great to hear on the answers!

Here is my take, in case you would like to trigger an Automation via AMPSCript, or i.e. directly on the exclusion script from JB, or via CloudPage, you can follow the below instructions.

After some rounds of testing, I was able to fully confirm that ProgramID property throws 500 CP errors, therefore ObjectID is the property needed to invoke the InvokePerform function for the Automation Object.

%%[
set @obj = CreateObject("Automation")
SetObjectProperty(@obj, "ObjectID", "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx")
Set @performStatusCode = InvokePerform(@obj, "start", @performStatusMessage)
]%%
performStatusCode: %%=v(@performStatusCode)=%%
performStatusMessage: %%=v(@performStatusMessage)=%%

If you need to retrieve the ObjectID quickly, you can use the network in the developer console as per the attached screenshot below.

ObjectID

In case you would like to retrieve the ObjectID directly from AMPScript, you can use some filtering by the Automation name or CustomerKey.

  %%[

var @rr, @ObjectID, @queryDefinitions
set @rr = CreateObject("RetrieveRequest")
SetObjectProperty(@rr, "ObjectType", "Automation")
AddObjectArrayItem(@rr, "Properties", "Name")
AddObjectArrayItem(@rr, "Properties", "ProgramID")

set @sfp = CreateObject("SimpleFilterPart")
SetObjectProperty(@sfp, "Property", "Name")
SetObjectProperty(@sfp, "SimpleOperator", "equals")
AddObjectArrayItem(@sfp, "Value", "test-SSJS-assets")

SetObjectProperty(@rr,"Filter", @sfp)

set @queryDefinitions = InvokeRetrieve(@rr, @rrStatus, @rrRequestID)

output(concat("rrStatus: ", @rrStatus))
output(concat("<br>rrRequestID: ", @rrRequestID))

if rowcount(@queryDefinitions) > 0 then

  var @queryDefinition, @ObjectID, @obj

  set @queryDefinition = Row(@queryDefinitions, 1)
  set @ObjectID = Field(@queryDefinition, "ObjectID")

  set @obj = CreateObject("Automation")

  SetObjectProperty(@obj, "ObjectID", @ObjectID)
  Set @performStatusCode = InvokePerform(@obj, "start", @performStatusMessage)

endif

]%%

As per the resultsbelow screenshot of the outcome, rendering the variables provides me an overall idea if the code was executed properly as per below screenshot. enter image description here End note: Please make sure the Automation is in an activedactive state.

I would like to close the discussion thread on this related topic Manage automation via ampscript API. If you have additional information to complement it would be great to hear on the answers!

Here is my take, in case you would like to trigger an Automation via AMPSCript, or i.e. directly on the exclusion script from JB, or via CloudPage, you can follow the below instructions.

After some rounds of testing, I was able to fully confirm that ProgramID property throws 500 CP errors, therefore ObjectID is the property needed to invoke the InvokePerform function for the Automation Object.

%%[
set @obj = CreateObject("Automation")
SetObjectProperty(@obj, "ObjectID", "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx")
Set @performStatusCode = InvokePerform(@obj, "start", @performStatusMessage)
]%%
performStatusCode: %%=v(@performStatusCode)=%%
performStatusMessage: %%=v(@performStatusMessage)=%%

If you need to retrieve the ObjectID quickly, you can use the network in the developer console as per the attached screenshot below.

ObjectID

In case you would like to retrieve the ObjectID directly from AMPScript, you can use some filtering by the Automation name or CustomerKey.

  %%[

var @rr, @ObjectID, @queryDefinitions
set @rr = CreateObject("RetrieveRequest")
SetObjectProperty(@rr, "ObjectType", "Automation")
AddObjectArrayItem(@rr, "Properties", "Name")
AddObjectArrayItem(@rr, "Properties", "ProgramID")

set @sfp = CreateObject("SimpleFilterPart")
SetObjectProperty(@sfp, "Property", "Name")
SetObjectProperty(@sfp, "SimpleOperator", "equals")
AddObjectArrayItem(@sfp, "Value", "test-SSJS-assets")

SetObjectProperty(@rr,"Filter", @sfp)

set @queryDefinitions = InvokeRetrieve(@rr, @rrStatus, @rrRequestID)

output(concat("rrStatus: ", @rrStatus))
output(concat("<br>rrRequestID: ", @rrRequestID))

if rowcount(@queryDefinitions) > 0 then

  var @queryDefinition, @ObjectID, @obj

  set @queryDefinition = Row(@queryDefinitions, 1)
  set @ObjectID = Field(@queryDefinition, "ObjectID")

  set @obj = CreateObject("Automation")

  SetObjectProperty(@obj, "ObjectID", @ObjectID)
  Set @performStatusCode = InvokePerform(@obj, "start", @performStatusMessage)

endif

]%%

As per the results screenshot, rendering the variables provides me an overall idea if the code was executed properly as per below screenshot. enter image description here End note: Please make sure the Automation is in an actived state.

I would like to close the discussion thread on this related topic Manage automation via ampscript API. If you have additional information to complement it would be great to hear on the answers!

Here is my take, in case you would like to trigger an Automation via AMPSCript, or i.e. directly on the exclusion script from JB, or via CloudPage, you can follow the below instructions.

After some rounds of testing, I was able to fully confirm that ProgramID property throws 500 CP errors, therefore ObjectID is the property needed to invoke the InvokePerform function for the Automation Object.

%%[
set @obj = CreateObject("Automation")
SetObjectProperty(@obj, "ObjectID", "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx")
Set @performStatusCode = InvokePerform(@obj, "start", @performStatusMessage)
]%%
performStatusCode: %%=v(@performStatusCode)=%%
performStatusMessage: %%=v(@performStatusMessage)=%%

If you need to retrieve the ObjectID quickly, you can use the network in the developer console as per the attached screenshot below.

ObjectID

In case you would like to retrieve the ObjectID directly from AMPScript, you can use some filtering by the Automation name or CustomerKey.

  %%[

var @rr, @ObjectID, @queryDefinitions
set @rr = CreateObject("RetrieveRequest")
SetObjectProperty(@rr, "ObjectType", "Automation")
AddObjectArrayItem(@rr, "Properties", "Name")
AddObjectArrayItem(@rr, "Properties", "ProgramID")

set @sfp = CreateObject("SimpleFilterPart")
SetObjectProperty(@sfp, "Property", "Name")
SetObjectProperty(@sfp, "SimpleOperator", "equals")
AddObjectArrayItem(@sfp, "Value", "test-SSJS-assets")

SetObjectProperty(@rr,"Filter", @sfp)

set @queryDefinitions = InvokeRetrieve(@rr, @rrStatus, @rrRequestID)

output(concat("rrStatus: ", @rrStatus))
output(concat("<br>rrRequestID: ", @rrRequestID))

if rowcount(@queryDefinitions) > 0 then

  var @queryDefinition, @ObjectID, @obj

  set @queryDefinition = Row(@queryDefinitions, 1)
  set @ObjectID = Field(@queryDefinition, "ObjectID")

  set @obj = CreateObject("Automation")

  SetObjectProperty(@obj, "ObjectID", @ObjectID)
  Set @performStatusCode = InvokePerform(@obj, "start", @performStatusMessage)

endif

]%%

As per the below screenshot of the outcome, rendering the variables provides me an overall idea if the code was executed properly. enter image description here End note: Please make sure the Automation is in an active state.

added 91 characters in body; edited tags; edited title
Source Link

Guide How to Trigger Automationmanage automation via AMPScriptampscript API - second part

InI would like to close the discussion thread on this related topic Manage automation via ampscript API. If you have additional information to complement it would be great to hear on the answers!

Here is my take, in case you would like to trigger an Automation via AMPSCript, or i.e. directly on the exclusion script from JB, or via CloudPage, you can follow the below instructions that have been validated.

After some rounds of testing, I was able to fully confirm that ProgramID property throws 500 CP errors, therefore ObjectID is the property needed to invoke the InvokePerform function for the Automation Object. We can close then the discussion thread from this related topic Manage automation via ampscript API

%%[
set @obj = CreateObject("Automation")
SetObjectProperty(@obj, "ObjectID", "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx")
Set @performStatusCode = InvokePerform(@obj, "start", @performStatusMessage)
]%%
performStatusCode: %%=v(@performStatusCode)=%%
performStatusMessage: %%=v(@performStatusMessage)=%%

If you need to retrieve the ObjectID quickly, you can use the network in the developer console as per the attached screenshot below.

ObjectID

In case you would like to retrieve the ObjectID directly from AMPScript, you can use some filtering by the Automation name or CustomerKey.

  %%[

var @rr, @ObjectID, @queryDefinitions
set @rr = CreateObject("RetrieveRequest")
SetObjectProperty(@rr, "ObjectType", "Automation")
AddObjectArrayItem(@rr, "Properties", "Name")
AddObjectArrayItem(@rr, "Properties", "ProgramID")

set @sfp = CreateObject("SimpleFilterPart")
SetObjectProperty(@sfp, "Property", "Name")
SetObjectProperty(@sfp, "SimpleOperator", "equals")
AddObjectArrayItem(@sfp, "Value", "test-SSJS-assets")

SetObjectProperty(@rr,"Filter", @sfp)

set @queryDefinitions = InvokeRetrieve(@rr, @rrStatus, @rrRequestID)

output(concat("rrStatus: ", @rrStatus))
output(concat("<br>rrRequestID: ", @rrRequestID))

if rowcount(@queryDefinitions) > 0 then

  var @queryDefinition, @ObjectID, @obj

  set @queryDefinition = Row(@queryDefinitions, 1)
  set @ObjectID = Field(@queryDefinition, "ObjectID")

  set @obj = CreateObject("Automation")

  SetObjectProperty(@obj, "ObjectID", @ObjectID)
  Set @performStatusCode = InvokePerform(@obj, "start", @performStatusMessage)

endif

]%%

As per the results screenshot, rendering the variables provides me an overall idea if the code was executed properly as per below screenshot. enter image description here End note: Please make sure the Automation is in an actived state.

Guide to Trigger Automation via AMPScript

In case you would like to trigger an Automation via AMPSCript, or i.e. directly on the exclusion script from JB, or via CloudPage, you can follow the below instructions that have been validated.

After some rounds of testing, I was able to fully confirm that ProgramID property throws 500 CP errors, therefore ObjectID is the property needed to invoke the InvokePerform function for the Automation Object. We can close then the discussion thread from this related topic Manage automation via ampscript API

%%[
set @obj = CreateObject("Automation")
SetObjectProperty(@obj, "ObjectID", "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx")
Set @performStatusCode = InvokePerform(@obj, "start", @performStatusMessage)
]%%
performStatusCode: %%=v(@performStatusCode)=%%
performStatusMessage: %%=v(@performStatusMessage)=%%

If you need to retrieve the ObjectID quickly, you can use the network in the developer console as per the attached screenshot below.

ObjectID

In case you would like to retrieve the ObjectID directly from AMPScript, you can use some filtering by the Automation name or CustomerKey.

  %%[

var @rr, @ObjectID, @queryDefinitions
set @rr = CreateObject("RetrieveRequest")
SetObjectProperty(@rr, "ObjectType", "Automation")
AddObjectArrayItem(@rr, "Properties", "Name")
AddObjectArrayItem(@rr, "Properties", "ProgramID")

set @sfp = CreateObject("SimpleFilterPart")
SetObjectProperty(@sfp, "Property", "Name")
SetObjectProperty(@sfp, "SimpleOperator", "equals")
AddObjectArrayItem(@sfp, "Value", "test-SSJS-assets")

SetObjectProperty(@rr,"Filter", @sfp)

set @queryDefinitions = InvokeRetrieve(@rr, @rrStatus, @rrRequestID)

output(concat("rrStatus: ", @rrStatus))
output(concat("<br>rrRequestID: ", @rrRequestID))

if rowcount(@queryDefinitions) > 0 then

  var @queryDefinition, @ObjectID, @obj

  set @queryDefinition = Row(@queryDefinitions, 1)
  set @ObjectID = Field(@queryDefinition, "ObjectID")

  set @obj = CreateObject("Automation")

  SetObjectProperty(@obj, "ObjectID", @ObjectID)
  Set @performStatusCode = InvokePerform(@obj, "start", @performStatusMessage)

endif

]%%

As per the results screenshot, rendering the variables provides me an overall idea if the code was executed properly as per below screenshot. enter image description here End note: Please make sure the Automation is in an actived state.

How to manage automation via ampscript API - second part

I would like to close the discussion thread on this related topic Manage automation via ampscript API. If you have additional information to complement it would be great to hear on the answers!

Here is my take, in case you would like to trigger an Automation via AMPSCript, or i.e. directly on the exclusion script from JB, or via CloudPage, you can follow the below instructions.

After some rounds of testing, I was able to fully confirm that ProgramID property throws 500 CP errors, therefore ObjectID is the property needed to invoke the InvokePerform function for the Automation Object.

%%[
set @obj = CreateObject("Automation")
SetObjectProperty(@obj, "ObjectID", "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx")
Set @performStatusCode = InvokePerform(@obj, "start", @performStatusMessage)
]%%
performStatusCode: %%=v(@performStatusCode)=%%
performStatusMessage: %%=v(@performStatusMessage)=%%

If you need to retrieve the ObjectID quickly, you can use the network in the developer console as per the attached screenshot below.

ObjectID

In case you would like to retrieve the ObjectID directly from AMPScript, you can use some filtering by the Automation name or CustomerKey.

  %%[

var @rr, @ObjectID, @queryDefinitions
set @rr = CreateObject("RetrieveRequest")
SetObjectProperty(@rr, "ObjectType", "Automation")
AddObjectArrayItem(@rr, "Properties", "Name")
AddObjectArrayItem(@rr, "Properties", "ProgramID")

set @sfp = CreateObject("SimpleFilterPart")
SetObjectProperty(@sfp, "Property", "Name")
SetObjectProperty(@sfp, "SimpleOperator", "equals")
AddObjectArrayItem(@sfp, "Value", "test-SSJS-assets")

SetObjectProperty(@rr,"Filter", @sfp)

set @queryDefinitions = InvokeRetrieve(@rr, @rrStatus, @rrRequestID)

output(concat("rrStatus: ", @rrStatus))
output(concat("<br>rrRequestID: ", @rrRequestID))

if rowcount(@queryDefinitions) > 0 then

  var @queryDefinition, @ObjectID, @obj

  set @queryDefinition = Row(@queryDefinitions, 1)
  set @ObjectID = Field(@queryDefinition, "ObjectID")

  set @obj = CreateObject("Automation")

  SetObjectProperty(@obj, "ObjectID", @ObjectID)
  Set @performStatusCode = InvokePerform(@obj, "start", @performStatusMessage)

endif

]%%

As per the results screenshot, rendering the variables provides me an overall idea if the code was executed properly as per below screenshot. enter image description here End note: Please make sure the Automation is in an actived state.

Source Link

Guide to Trigger Automation via AMPScript

In case you would like to trigger an Automation via AMPSCript, or i.e. directly on the exclusion script from JB, or via CloudPage, you can follow the below instructions that have been validated.

After some rounds of testing, I was able to fully confirm that ProgramID property throws 500 CP errors, therefore ObjectID is the property needed to invoke the InvokePerform function for the Automation Object. We can close then the discussion thread from this related topic Manage automation via ampscript API

%%[
set @obj = CreateObject("Automation")
SetObjectProperty(@obj, "ObjectID", "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx")
Set @performStatusCode = InvokePerform(@obj, "start", @performStatusMessage)
]%%
performStatusCode: %%=v(@performStatusCode)=%%
performStatusMessage: %%=v(@performStatusMessage)=%%

If you need to retrieve the ObjectID quickly, you can use the network in the developer console as per the attached screenshot below.

ObjectID

In case you would like to retrieve the ObjectID directly from AMPScript, you can use some filtering by the Automation name or CustomerKey.

  %%[

var @rr, @ObjectID, @queryDefinitions
set @rr = CreateObject("RetrieveRequest")
SetObjectProperty(@rr, "ObjectType", "Automation")
AddObjectArrayItem(@rr, "Properties", "Name")
AddObjectArrayItem(@rr, "Properties", "ProgramID")

set @sfp = CreateObject("SimpleFilterPart")
SetObjectProperty(@sfp, "Property", "Name")
SetObjectProperty(@sfp, "SimpleOperator", "equals")
AddObjectArrayItem(@sfp, "Value", "test-SSJS-assets")

SetObjectProperty(@rr,"Filter", @sfp)

set @queryDefinitions = InvokeRetrieve(@rr, @rrStatus, @rrRequestID)

output(concat("rrStatus: ", @rrStatus))
output(concat("<br>rrRequestID: ", @rrRequestID))

if rowcount(@queryDefinitions) > 0 then

  var @queryDefinition, @ObjectID, @obj

  set @queryDefinition = Row(@queryDefinitions, 1)
  set @ObjectID = Field(@queryDefinition, "ObjectID")

  set @obj = CreateObject("Automation")

  SetObjectProperty(@obj, "ObjectID", @ObjectID)
  Set @performStatusCode = InvokePerform(@obj, "start", @performStatusMessage)

endif

]%%

As per the results screenshot, rendering the variables provides me an overall idea if the code was executed properly as per below screenshot. enter image description here End note: Please make sure the Automation is in an actived state.